@zohodesk/dot 1.0.0-temp-175.6 → 1.0.0-temp-181

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 (237) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +30 -0
  3. package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +0 -1
  4. package/assets/Appearance/light/mode/Dot_LightMode.module.css +0 -1
  5. package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +0 -1
  6. package/coverage/ExternalLink/ExternalLink.js.html +1 -1
  7. package/coverage/ExternalLink/ExternalLink.module.css.html +1 -1
  8. package/coverage/ExternalLink/index.html +1 -1
  9. package/coverage/ExternalLink/props/defaultProps.js.html +1 -1
  10. package/coverage/ExternalLink/props/index.html +1 -1
  11. package/coverage/ExternalLink/props/propTypes.js.html +1 -1
  12. package/coverage/IconButton/IconButton.js.html +7 -7
  13. package/coverage/IconButton/IconButton.module.css.html +1 -1
  14. package/coverage/IconButton/index.html +11 -11
  15. package/coverage/IconButton/props/defaultProps.js.html +1 -1
  16. package/coverage/IconButton/props/index.html +1 -1
  17. package/coverage/IconButton/props/propTypes.js.html +1 -1
  18. package/coverage/Image/Image.js.html +1 -1
  19. package/coverage/Image/Image.module.css.html +1 -1
  20. package/coverage/Image/index.html +1 -1
  21. package/coverage/Image/props/defaultProps.js.html +1 -1
  22. package/coverage/Image/props/index.html +1 -1
  23. package/coverage/Image/props/propTypes.js.html +1 -1
  24. package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.js.html +1 -1
  25. package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.module.css.html +1 -1
  26. package/coverage/avatar/AvatarWithTeam/index.html +1 -1
  27. package/coverage/avatar/AvatarWithTeam/props/defaultProps.js.html +1 -1
  28. package/coverage/avatar/AvatarWithTeam/props/index.html +1 -1
  29. package/coverage/avatar/AvatarWithTeam/props/propTypes.js.html +1 -1
  30. package/coverage/coverage-final.json +16 -16
  31. package/coverage/coverage-summary.json +17 -17
  32. package/coverage/index.html +11 -11
  33. package/es/Drawer/Drawer.js +6 -3
  34. package/es/Drawer/props/defaultProps.js +2 -1
  35. package/es/Drawer/props/propTypes.js +2 -1
  36. package/es/Hooks/Dragger/useDragger.js +4 -3
  37. package/es/IconButton/IconButton.js +2 -2
  38. package/es/NewStar/NewStar.module.css +128 -67
  39. package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +4 -0
  40. package/es/form/fields/TextEditor/TextEditor.module.css +63 -47
  41. package/es/list/status/StatusDropdown/StatusDropdown.js +2 -1
  42. package/es/list/status/StatusListItem/StatusListItem.js +12 -5
  43. package/es/list/status/StatusListItem/props/defaultProps.js +2 -1
  44. package/es/list/status/StatusListItem/props/propTypes.js +3 -1
  45. package/es/lookup/Lookup/Lookup.js +6 -3
  46. package/es/v1/DotWrapper/DotWrapper.js +28 -0
  47. package/es/v1/DotWrapper/libraryChunks/appearance/component/DarkMode_Component.js +1 -0
  48. package/es/v1/DotWrapper/libraryChunks/appearance/component/LightMode_Component.js +1 -0
  49. package/es/v1/DotWrapper/libraryChunks/appearance/component/PureDarkMode_Component.js +1 -0
  50. package/es/v1/DotWrapper/libraryChunks/appearance/dot/DarkMode_Dot.js +1 -0
  51. package/es/v1/DotWrapper/libraryChunks/appearance/dot/LightMode_Dot.js +1 -0
  52. package/es/v1/DotWrapper/libraryChunks/appearance/dot/PureDarkMode_Dot.js +1 -0
  53. package/es/v1/DotWrapper/libraryChunks/appearance/svg/DarkMode_SVG.js +1 -0
  54. package/es/v1/DotWrapper/libraryChunks/appearance/svg/LightMode_SVG.js +1 -0
  55. package/es/v1/DotWrapper/libraryChunks/appearance/svg/PureDarkMode_SVG.js +1 -0
  56. package/es/v1/DotWrapper/libraryChunks/dynamicImports.js +19 -0
  57. package/es/v1/DotWrapper/libraryChunks/themes/component/blue/Blue_Dark_Component.js +3 -0
  58. package/es/v1/DotWrapper/libraryChunks/themes/component/blue/Blue_Light_Component.js +3 -0
  59. package/es/v1/DotWrapper/libraryChunks/themes/component/blue/Blue_PureDark_Component.js +3 -0
  60. package/es/v1/DotWrapper/libraryChunks/themes/component/green/Green_Dark_Component.js +3 -0
  61. package/es/v1/DotWrapper/libraryChunks/themes/component/green/Green_Light_Component.js +3 -0
  62. package/es/v1/DotWrapper/libraryChunks/themes/component/green/Green_PureDark_Component.js +3 -0
  63. package/es/v1/DotWrapper/libraryChunks/themes/component/orange/Orange_Dark_Component.js +3 -0
  64. package/es/v1/DotWrapper/libraryChunks/themes/component/orange/Orange_Light_Component.js +3 -0
  65. package/es/v1/DotWrapper/libraryChunks/themes/component/orange/Orange_PureDark_Component.js +3 -0
  66. package/es/v1/DotWrapper/libraryChunks/themes/component/red/Red_Dark_Component.js +3 -0
  67. package/es/v1/DotWrapper/libraryChunks/themes/component/red/Red_Light_Component.js +3 -0
  68. package/es/v1/DotWrapper/libraryChunks/themes/component/red/Red_PureDark_Component.js +3 -0
  69. package/es/v1/DotWrapper/libraryChunks/themes/component/yellow/Yellow_Dark_Component.js +3 -0
  70. package/es/v1/DotWrapper/libraryChunks/themes/component/yellow/Yellow_Light_Component.js +3 -0
  71. package/es/v1/DotWrapper/libraryChunks/themes/component/yellow/Yellow_PureDark_Component.js +3 -0
  72. package/es/v1/DotWrapper/libraryChunks/themes/dot/blue/Blue_Dark_Dot.js +1 -0
  73. package/es/v1/DotWrapper/libraryChunks/themes/dot/blue/Blue_Light_Dot.js +1 -0
  74. package/es/v1/DotWrapper/libraryChunks/themes/dot/blue/Blue_PureDark_Dot.js +1 -0
  75. package/es/v1/DotWrapper/libraryChunks/themes/dot/green/Green_Dark_Dot.js +1 -0
  76. package/es/v1/DotWrapper/libraryChunks/themes/dot/green/Green_Light_Dot.js +1 -0
  77. package/es/v1/DotWrapper/libraryChunks/themes/dot/green/Green_PureDark_Dot.js +1 -0
  78. package/es/v1/DotWrapper/libraryChunks/themes/dot/orange/Orange_Dark_Dot.js +1 -0
  79. package/es/v1/DotWrapper/libraryChunks/themes/dot/orange/Orange_Light_Dot.js +1 -0
  80. package/es/v1/DotWrapper/libraryChunks/themes/dot/orange/Orange_PureDark_Dot.js +1 -0
  81. package/es/v1/DotWrapper/libraryChunks/themes/dot/red/Red_Dark_Dot.js +1 -0
  82. package/es/v1/DotWrapper/libraryChunks/themes/dot/red/Red_Light_Dot.js +1 -0
  83. package/es/v1/DotWrapper/libraryChunks/themes/dot/red/Red_PureDark_Dot.js +1 -0
  84. package/es/v1/DotWrapper/libraryChunks/themes/dot/yellow/Yellow_Dark_Dot.js +1 -0
  85. package/es/v1/DotWrapper/libraryChunks/themes/dot/yellow/Yellow_Light_Dot.js +1 -0
  86. package/es/v1/DotWrapper/libraryChunks/themes/dot/yellow/Yellow_PureDark_Dot.js +1 -0
  87. package/es/v1/DotWrapper/libraryChunks/themes/svg/blue/Blue_Dark_SVG.js +1 -0
  88. package/es/v1/DotWrapper/libraryChunks/themes/svg/blue/Blue_Light_SVG.js +1 -0
  89. package/es/v1/DotWrapper/libraryChunks/themes/svg/blue/Blue_PureDark_SVG.js +1 -0
  90. package/es/v1/DotWrapper/libraryChunks/themes/svg/green/Green_Dark_SVG.js +1 -0
  91. package/es/v1/DotWrapper/libraryChunks/themes/svg/green/Green_Light_SVG.js +1 -0
  92. package/es/v1/DotWrapper/libraryChunks/themes/svg/green/Green_PureDark_SVG.js +1 -0
  93. package/es/v1/DotWrapper/libraryChunks/themes/svg/orange/Orange_Dark_SVG.js +1 -0
  94. package/es/v1/DotWrapper/libraryChunks/themes/svg/orange/Orange_Light_SVG.js +1 -0
  95. package/es/v1/DotWrapper/libraryChunks/themes/svg/orange/Orange_PureDark_SVG.js +1 -0
  96. package/es/v1/DotWrapper/libraryChunks/themes/svg/red/Red_Dark_SVG.js +1 -0
  97. package/es/v1/DotWrapper/libraryChunks/themes/svg/red/Red_Light_SVG.js +1 -0
  98. package/es/v1/DotWrapper/libraryChunks/themes/svg/red/Red_PureDark_SVG.js +1 -0
  99. package/es/v1/DotWrapper/libraryChunks/themes/svg/yellow/Yellow_Dark_SVG.js +1 -0
  100. package/es/v1/DotWrapper/libraryChunks/themes/svg/yellow/Yellow_Light_SVG.js +1 -0
  101. package/es/v1/DotWrapper/libraryChunks/themes/svg/yellow/Yellow_PureDark_SVG.js +1 -0
  102. package/es/v1/DotWrapper/props/defaultProps.js +7 -0
  103. package/es/v1/DotWrapper/props/propTypes.js +8 -0
  104. package/es/v1/DotWrapper/utils/appearanceProperties.js +46 -0
  105. package/es/v1/DotWrapper/utils/errorMessage.js +7 -0
  106. package/es/v1/DotWrapper/utils/importFiles.js +18 -0
  107. package/es/v1/DotWrapper/utils/themeProperties.js +220 -0
  108. package/es/v1/Drawer/Drawer.js +6 -3
  109. package/es/v1/Drawer/props/defaultProps.js +2 -1
  110. package/es/v1/Drawer/props/propTypes.js +2 -1
  111. package/es/v1/GlobalNotification/GlobalNotification.js +51 -19
  112. package/es/v1/GlobalNotification/props/defaultProps.js +3 -1
  113. package/es/v1/GlobalNotification/props/propTypes.js +12 -2
  114. package/es/v1/IconButton/IconButton.js +2 -2
  115. package/es/v1/form/fields/SelectField/SelectField.js +1 -9
  116. package/es/v1/form/fields/TextBoxField/TextBoxField.js +122 -142
  117. package/es/v1/form/fields/TextEditorField/TextEditorField.js +133 -153
  118. package/es/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +137 -178
  119. package/es/v1/form/fields/TextareaField/TextareaField.js +113 -137
  120. package/es/v1/form/fields/ValidationMessage/ValidationMessage.js +43 -43
  121. package/es/v1/form/layout/Field/Field.js +24 -28
  122. package/es/v1/form/layout/Section/Section.js +25 -33
  123. package/es/v1/form/layout/Section/props/propTypes.js +0 -1
  124. package/es/v1/list/Subject/Subject.js +39 -48
  125. package/es/v1/list/TagNew/TagNew.js +18 -27
  126. package/es/v1/list/Thread/Thread.js +26 -35
  127. package/es/v1/list/status/StatusDropdown/StatusDropdown.js +2 -1
  128. package/es/v1/list/status/StatusListItem/StatusListItem.js +12 -5
  129. package/es/v1/list/status/StatusListItem/props/defaultProps.js +2 -1
  130. package/es/v1/list/status/StatusListItem/props/propTypes.js +3 -1
  131. package/es/v1/lookup/Lookup/Lookup.js +6 -3
  132. package/es/version2/GlobalNotification/GlobalNotification.module.css +1 -2
  133. package/lib/Drawer/Drawer.js +6 -3
  134. package/lib/Drawer/props/defaultProps.js +2 -1
  135. package/lib/Drawer/props/propTypes.js +2 -1
  136. package/lib/Hooks/Dragger/useDragger.js +4 -3
  137. package/lib/IconButton/IconButton.js +2 -2
  138. package/lib/NewStar/NewStar.module.css +128 -67
  139. package/lib/emptystate/CommonEmptyState/CommonEmptyState.module.css +4 -0
  140. package/lib/form/fields/TextEditor/TextEditor.module.css +63 -47
  141. package/lib/list/status/StatusDropdown/StatusDropdown.js +2 -1
  142. package/lib/list/status/StatusListItem/StatusListItem.js +12 -5
  143. package/lib/list/status/StatusListItem/props/defaultProps.js +2 -1
  144. package/lib/list/status/StatusListItem/props/propTypes.js +3 -1
  145. package/lib/lookup/Lookup/Lookup.js +14 -3
  146. package/lib/v1/DotWrapper/DotWrapper.js +41 -0
  147. package/lib/v1/DotWrapper/libraryChunks/appearance/component/DarkMode_Component.js +3 -0
  148. package/lib/v1/DotWrapper/libraryChunks/appearance/component/LightMode_Component.js +3 -0
  149. package/lib/v1/DotWrapper/libraryChunks/appearance/component/PureDarkMode_Component.js +3 -0
  150. package/lib/v1/DotWrapper/libraryChunks/appearance/dot/DarkMode_Dot.js +3 -0
  151. package/lib/v1/DotWrapper/libraryChunks/appearance/dot/LightMode_Dot.js +3 -0
  152. package/lib/v1/DotWrapper/libraryChunks/appearance/dot/PureDarkMode_Dot.js +3 -0
  153. package/lib/v1/DotWrapper/libraryChunks/appearance/svg/DarkMode_SVG.js +3 -0
  154. package/lib/v1/DotWrapper/libraryChunks/appearance/svg/LightMode_SVG.js +3 -0
  155. package/lib/v1/DotWrapper/libraryChunks/appearance/svg/PureDarkMode_SVG.js +3 -0
  156. package/lib/v1/DotWrapper/libraryChunks/dynamicImports.js +33 -0
  157. package/lib/v1/DotWrapper/libraryChunks/themes/component/blue/Blue_Dark_Component.js +7 -0
  158. package/lib/v1/DotWrapper/libraryChunks/themes/component/blue/Blue_Light_Component.js +7 -0
  159. package/lib/v1/DotWrapper/libraryChunks/themes/component/blue/Blue_PureDark_Component.js +7 -0
  160. package/lib/v1/DotWrapper/libraryChunks/themes/component/green/Green_Dark_Component.js +7 -0
  161. package/lib/v1/DotWrapper/libraryChunks/themes/component/green/Green_Light_Component.js +7 -0
  162. package/lib/v1/DotWrapper/libraryChunks/themes/component/green/Green_PureDark_Component.js +7 -0
  163. package/lib/v1/DotWrapper/libraryChunks/themes/component/orange/Orange_Dark_Component.js +7 -0
  164. package/lib/v1/DotWrapper/libraryChunks/themes/component/orange/Orange_Light_Component.js +7 -0
  165. package/lib/v1/DotWrapper/libraryChunks/themes/component/orange/Orange_PureDark_Component.js +7 -0
  166. package/lib/v1/DotWrapper/libraryChunks/themes/component/red/Red_Dark_Component.js +7 -0
  167. package/lib/v1/DotWrapper/libraryChunks/themes/component/red/Red_Light_Component.js +7 -0
  168. package/lib/v1/DotWrapper/libraryChunks/themes/component/red/Red_PureDark_Component.js +7 -0
  169. package/lib/v1/DotWrapper/libraryChunks/themes/component/yellow/Yellow_Dark_Component.js +7 -0
  170. package/lib/v1/DotWrapper/libraryChunks/themes/component/yellow/Yellow_Light_Component.js +7 -0
  171. package/lib/v1/DotWrapper/libraryChunks/themes/component/yellow/Yellow_PureDark_Component.js +7 -0
  172. package/lib/v1/DotWrapper/libraryChunks/themes/dot/blue/Blue_Dark_Dot.js +3 -0
  173. package/lib/v1/DotWrapper/libraryChunks/themes/dot/blue/Blue_Light_Dot.js +3 -0
  174. package/lib/v1/DotWrapper/libraryChunks/themes/dot/blue/Blue_PureDark_Dot.js +3 -0
  175. package/lib/v1/DotWrapper/libraryChunks/themes/dot/green/Green_Dark_Dot.js +3 -0
  176. package/lib/v1/DotWrapper/libraryChunks/themes/dot/green/Green_Light_Dot.js +3 -0
  177. package/lib/v1/DotWrapper/libraryChunks/themes/dot/green/Green_PureDark_Dot.js +3 -0
  178. package/lib/v1/DotWrapper/libraryChunks/themes/dot/orange/Orange_Dark_Dot.js +3 -0
  179. package/lib/v1/DotWrapper/libraryChunks/themes/dot/orange/Orange_Light_Dot.js +3 -0
  180. package/lib/v1/DotWrapper/libraryChunks/themes/dot/orange/Orange_PureDark_Dot.js +3 -0
  181. package/lib/v1/DotWrapper/libraryChunks/themes/dot/red/Red_Dark_Dot.js +3 -0
  182. package/lib/v1/DotWrapper/libraryChunks/themes/dot/red/Red_Light_Dot.js +3 -0
  183. package/lib/v1/DotWrapper/libraryChunks/themes/dot/red/Red_PureDark_Dot.js +3 -0
  184. package/lib/v1/DotWrapper/libraryChunks/themes/dot/yellow/Yellow_Dark_Dot.js +3 -0
  185. package/lib/v1/DotWrapper/libraryChunks/themes/dot/yellow/Yellow_Light_Dot.js +3 -0
  186. package/lib/v1/DotWrapper/libraryChunks/themes/dot/yellow/Yellow_PureDark_Dot.js +3 -0
  187. package/lib/v1/DotWrapper/libraryChunks/themes/svg/blue/Blue_Dark_SVG.js +3 -0
  188. package/lib/v1/DotWrapper/libraryChunks/themes/svg/blue/Blue_Light_SVG.js +3 -0
  189. package/lib/v1/DotWrapper/libraryChunks/themes/svg/blue/Blue_PureDark_SVG.js +3 -0
  190. package/lib/v1/DotWrapper/libraryChunks/themes/svg/green/Green_Dark_SVG.js +3 -0
  191. package/lib/v1/DotWrapper/libraryChunks/themes/svg/green/Green_Light_SVG.js +3 -0
  192. package/lib/v1/DotWrapper/libraryChunks/themes/svg/green/Green_PureDark_SVG.js +3 -0
  193. package/lib/v1/DotWrapper/libraryChunks/themes/svg/orange/Orange_Dark_SVG.js +3 -0
  194. package/lib/v1/DotWrapper/libraryChunks/themes/svg/orange/Orange_Light_SVG.js +3 -0
  195. package/lib/v1/DotWrapper/libraryChunks/themes/svg/orange/Orange_PureDark_SVG.js +3 -0
  196. package/lib/v1/DotWrapper/libraryChunks/themes/svg/red/Red_Dark_SVG.js +3 -0
  197. package/lib/v1/DotWrapper/libraryChunks/themes/svg/red/Red_Light_SVG.js +3 -0
  198. package/lib/v1/DotWrapper/libraryChunks/themes/svg/red/Red_PureDark_SVG.js +3 -0
  199. package/lib/v1/DotWrapper/libraryChunks/themes/svg/yellow/Yellow_Dark_SVG.js +3 -0
  200. package/lib/v1/DotWrapper/libraryChunks/themes/svg/yellow/Yellow_Light_SVG.js +3 -0
  201. package/lib/v1/DotWrapper/libraryChunks/themes/svg/yellow/Yellow_PureDark_SVG.js +3 -0
  202. package/lib/v1/DotWrapper/props/defaultProps.js +14 -0
  203. package/lib/v1/DotWrapper/props/propTypes.js +19 -0
  204. package/lib/v1/DotWrapper/utils/appearanceProperties.js +79 -0
  205. package/lib/v1/DotWrapper/utils/errorMessage.js +14 -0
  206. package/lib/v1/DotWrapper/utils/importFiles.js +25 -0
  207. package/lib/v1/DotWrapper/utils/themeProperties.js +325 -0
  208. package/lib/v1/Drawer/Drawer.js +6 -3
  209. package/lib/v1/Drawer/props/defaultProps.js +2 -1
  210. package/lib/v1/Drawer/props/propTypes.js +2 -1
  211. package/lib/v1/GlobalNotification/GlobalNotification.js +66 -17
  212. package/lib/v1/GlobalNotification/props/defaultProps.js +3 -1
  213. package/lib/v1/GlobalNotification/props/propTypes.js +17 -4
  214. package/lib/v1/IconButton/IconButton.js +2 -2
  215. package/lib/v1/form/fields/SelectField/SelectField.js +1 -7
  216. package/lib/v1/form/fields/TextBoxField/TextBoxField.js +125 -181
  217. package/lib/v1/form/fields/TextEditorField/TextEditorField.js +138 -193
  218. package/lib/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +160 -212
  219. package/lib/v1/form/fields/TextareaField/TextareaField.js +117 -177
  220. package/lib/v1/form/fields/ValidationMessage/ValidationMessage.js +41 -80
  221. package/lib/v1/form/layout/Field/Field.js +22 -69
  222. package/lib/v1/form/layout/Section/Section.js +27 -72
  223. package/lib/v1/form/layout/Section/props/propTypes.js +0 -1
  224. package/lib/v1/list/Subject/Subject.js +39 -87
  225. package/lib/v1/list/TagNew/TagNew.js +18 -66
  226. package/lib/v1/list/Thread/Thread.js +25 -73
  227. package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +2 -1
  228. package/lib/v1/list/status/StatusListItem/StatusListItem.js +12 -5
  229. package/lib/v1/list/status/StatusListItem/props/defaultProps.js +2 -1
  230. package/lib/v1/list/status/StatusListItem/props/propTypes.js +3 -1
  231. package/lib/v1/lookup/Lookup/Lookup.js +11 -6
  232. package/lib/version2/GlobalNotification/GlobalNotification.module.css +1 -2
  233. package/package.json +13 -13
  234. package/prePublish.js +0 -69
  235. package/react-cli.config.js +6 -1
  236. package/result.json +1 -1
  237. package/unittest/index.html +1 -1
@@ -1,7 +1,7 @@
1
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
2
 
3
3
  /**** Libraries ****/
4
- import React, { PureComponent } from 'react';
4
+ import React, { memo, useRef } from 'react';
5
5
  import { defaultProps } from './props/defaultProps';
6
6
  import { propTypes } from './props/propTypes';
7
7
  /**** Components ****/
@@ -13,166 +13,146 @@ import FieldContainer from '../FieldContainer/FieldContainer';
13
13
  /** Css */
14
14
 
15
15
  import style from '../../../../form/fields/Fields.module.css';
16
- export default class TextEditorField extends PureComponent {
17
- constructor(props) {
18
- super(props);
19
- this.handleChange = this.handleChange.bind(this);
20
- this.handleGetRef = this.handleGetRef.bind(this);
21
- this.handleLabelClick = this.handleLabelClick.bind(this);
22
- this.renderEnd = this.renderEnd.bind(this);
23
- }
24
16
 
25
- handleChange(value) {
26
- let {
27
- id,
28
- onChange
29
- } = this.props;
17
+ const TextEditorField = props => {
18
+ const {
19
+ labelName,
20
+ id,
21
+ isMandatory,
22
+ value,
23
+ validationMessage,
24
+ validationPalette,
25
+ isReadOnly,
26
+ onAttachmentUpload,
27
+ needEditor,
28
+ dataId,
29
+ dataSelectorId,
30
+ isDisabled,
31
+ fieldSize,
32
+ textBoxSize,
33
+ textBoxVariant,
34
+ labelPalette,
35
+ labelCustomClass,
36
+ infoText,
37
+ isLocked,
38
+ lockedInfoText,
39
+ errorType,
40
+ EDITORURL,
41
+ editorMode,
42
+ isCustomScroll,
43
+ initCallback,
44
+ loadingComponent,
45
+ handleAlertMessage,
46
+ editorCallback,
47
+ editorBlurCallback,
48
+ editorOptions,
49
+ onFocus,
50
+ isEditorDefaultOpen,
51
+ changeEditorContent,
52
+ shouldEditorUpdateContent,
53
+ setInlineAttachmentInProgress,
54
+ handleEditorDropUpload,
55
+ ImgLazyLoad,
56
+ needInlineAttachment,
57
+ i18nKeys,
58
+ className,
59
+ children,
60
+ ePhiData,
61
+ customProps,
62
+ onChange,
63
+ getRef,
64
+ isFocusOnLabelClick
65
+ } = props;
66
+ const textEditorEleRef = useRef(null);
67
+ const {
68
+ LabelProps = {},
69
+ TextEditorWrapperProps = {},
70
+ ValidationMessageProps = {}
71
+ } = customProps;
72
+
73
+ const handleChange = value => {
30
74
  onChange && onChange(id, value);
31
- }
75
+ };
32
76
 
33
- handleGetRef(el) {
34
- let {
35
- getRef,
36
- id
37
- } = this.props;
38
- this.textEditor = el;
77
+ const handleGetRef = el => {
78
+ textEditorEleRef.current = el;
39
79
  getRef && getRef(el, id);
40
- }
41
-
42
- handleLabelClick() {
43
- let {
44
- isFocusOnLabelClick,
45
- isDisabled,
46
- isReadOnly
47
- } = this.props;
80
+ };
48
81
 
49
- if (isFocusOnLabelClick && !isDisabled && !isReadOnly && this.textEditor && this.textEditor.focus) {
50
- this.textEditor.focus();
82
+ const handleLabelClick = () => {
83
+ if (isFocusOnLabelClick && !isDisabled && !isReadOnly && textEditorEleRef.current && textEditorEleRef.current.focus) {
84
+ textEditorEleRef.current.focus();
51
85
  }
52
- }
86
+ };
53
87
 
54
- renderEnd() {
55
- let {
56
- children
57
- } = this.props;
88
+ const renderEnd = () => {
58
89
  return children ? children : null;
59
- }
90
+ };
60
91
 
61
- render() {
62
- let {
63
- labelName,
64
- id,
65
- isMandatory,
66
- value,
67
- validationMessage,
68
- validationPalette,
69
- isReadOnly,
70
- onAttachmentUpload,
71
- needEditor,
72
- dataId,
73
- dataSelectorId,
74
- isDisabled,
75
- fieldSize,
76
- textBoxSize,
77
- textBoxVariant,
78
- labelPalette,
79
- labelCustomClass,
80
- infoText,
81
- isLocked,
82
- lockedInfoText,
83
- errorType,
84
- EDITORURL,
85
- editorMode,
86
- isCustomScroll,
87
- initCallback,
88
- loadingComponent,
89
- handleAlertMessage,
90
- editorCallback,
91
- editorBlurCallback,
92
- editorOptions,
93
- onFocus,
94
- isEditorDefaultOpen,
95
- changeEditorContent,
96
- shouldEditorUpdateContent,
97
- setInlineAttachmentInProgress,
98
- handleEditorDropUpload,
99
- ImgLazyLoad,
100
- needInlineAttachment,
101
- i18nKeys,
102
- className,
103
- children,
104
- ePhiData,
105
- customProps
106
- } = this.props;
107
- const {
108
- LabelProps = {},
109
- TextEditorWrapperProps = {},
110
- ValidationMessageProps = {}
111
- } = customProps;
112
- return /*#__PURE__*/React.createElement("div", {
113
- className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''} ${className || ''}`,
114
- "data-selector-id": dataSelectorId
115
- }, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
116
- infoText: infoText,
117
- isLocked: isLocked,
118
- lockedInfoText: lockedInfoText,
119
- ePhiData: ePhiData,
120
- dataId: dataId,
121
- renderProps: {
122
- end: this.renderEnd
123
- }
124
- }, /*#__PURE__*/React.createElement(Label, _extends({
125
- text: labelName,
126
- size: fieldSize === 'small' ? 'small' : 'medium',
127
- htmlFor: !isReadOnly && !isDisabled ? id : undefined,
128
- palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
129
- onClick: this.handleLabelClick,
130
- customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
131
- dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
132
- }, LabelProps))), /*#__PURE__*/React.createElement("div", {
133
- className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
134
- }, /*#__PURE__*/React.createElement(TextEditorWrapper, _extends({
135
- needEditor: needEditor,
136
- onChange: this.handleChange,
137
- id: id,
138
- value: value,
139
- isReadOnly: isReadOnly,
140
- getRef: this.handleGetRef,
141
- onAttachmentUpload: onAttachmentUpload,
142
- dataId: dataId,
143
- isDisabled: isDisabled,
144
- textBoxSize: fieldSize === 'medium' ? textBoxSize : 'xsmall',
145
- textBoxVariant: textBoxVariant,
146
- EDITORURL: EDITORURL,
147
- editorMode: editorMode,
148
- isCustomScroll: isCustomScroll,
149
- initCallback: initCallback,
150
- loadingComponent: loadingComponent,
151
- handleAlertMessage: handleAlertMessage,
152
- editorCallback: editorCallback,
153
- i18nKeys: i18nKeys,
154
- ImgLazyLoad: ImgLazyLoad,
155
- editorOptions: editorOptions,
156
- editorBlurCallback: editorBlurCallback,
157
- onFocus: onFocus,
158
- isEditorDefaultOpen: isEditorDefaultOpen,
159
- changeEditorContent: changeEditorContent,
160
- shouldEditorUpdateContent: shouldEditorUpdateContent,
161
- setInlineAttachmentInProgress: setInlineAttachmentInProgress,
162
- handleEditorDropUpload: handleEditorDropUpload,
163
- needInlineAttachment: needInlineAttachment
164
- }, TextEditorWrapperProps))), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
165
- text: validationMessage,
166
- palette: validationPalette,
167
- type: errorType,
168
- dataId: `${dataId}_ValidationMessage`
169
- }, ValidationMessageProps)));
170
- }
92
+ return /*#__PURE__*/React.createElement("div", {
93
+ className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''} ${className || ''}`,
94
+ "data-selector-id": dataSelectorId
95
+ }, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
96
+ infoText: infoText,
97
+ isLocked: isLocked,
98
+ lockedInfoText: lockedInfoText,
99
+ ePhiData: ePhiData,
100
+ dataId: dataId,
101
+ renderProps: {
102
+ end: renderEnd
103
+ }
104
+ }, /*#__PURE__*/React.createElement(Label, _extends({
105
+ text: labelName,
106
+ size: fieldSize === 'small' ? 'small' : 'medium',
107
+ htmlFor: !isReadOnly && !isDisabled ? id : undefined,
108
+ palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
109
+ onClick: handleLabelClick,
110
+ customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
111
+ dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
112
+ }, LabelProps))), /*#__PURE__*/React.createElement("div", {
113
+ className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
114
+ }, /*#__PURE__*/React.createElement(TextEditorWrapper, _extends({
115
+ needEditor: needEditor,
116
+ onChange: handleChange,
117
+ id: id,
118
+ value: value,
119
+ isReadOnly: isReadOnly,
120
+ getRef: handleGetRef,
121
+ onAttachmentUpload: onAttachmentUpload,
122
+ dataId: dataId,
123
+ isDisabled: isDisabled,
124
+ textBoxSize: fieldSize === 'medium' ? textBoxSize : 'xsmall',
125
+ textBoxVariant: textBoxVariant,
126
+ EDITORURL: EDITORURL,
127
+ editorMode: editorMode,
128
+ isCustomScroll: isCustomScroll,
129
+ initCallback: initCallback,
130
+ loadingComponent: loadingComponent,
131
+ handleAlertMessage: handleAlertMessage,
132
+ editorCallback: editorCallback,
133
+ i18nKeys: i18nKeys,
134
+ ImgLazyLoad: ImgLazyLoad,
135
+ editorOptions: editorOptions,
136
+ editorBlurCallback: editorBlurCallback,
137
+ onFocus: onFocus,
138
+ isEditorDefaultOpen: isEditorDefaultOpen,
139
+ changeEditorContent: changeEditorContent,
140
+ shouldEditorUpdateContent: shouldEditorUpdateContent,
141
+ setInlineAttachmentInProgress: setInlineAttachmentInProgress,
142
+ handleEditorDropUpload: handleEditorDropUpload,
143
+ needInlineAttachment: needInlineAttachment
144
+ }, TextEditorWrapperProps))), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
145
+ text: validationMessage,
146
+ palette: validationPalette,
147
+ type: errorType,
148
+ dataId: `${dataId}_ValidationMessage`
149
+ }, ValidationMessageProps)));
150
+ };
171
151
 
172
- }
173
152
  TextEditorField.propTypes = propTypes;
174
- TextEditorField.defaultProps = defaultProps; // if (__DOCS__) {
175
- // TextEditorField.docs = {
176
- // componentGroup: 'Fields'
177
- // };
178
- // }
153
+ TextEditorField.defaultProps = defaultProps;
154
+ const MemoizedTextEditorField = /*#__PURE__*/memo(TextEditorField);
155
+ MemoizedTextEditorField.propTypes = propTypes;
156
+ MemoizedTextEditorField.defaultProps = defaultProps;
157
+ MemoizedTextEditorField.displayName = 'TextEditorField';
158
+ export default TextEditorField;
@@ -1,10 +1,11 @@
1
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
2
 
3
- import React, { Component } from 'react';
3
+ import React, { useState } from 'react';
4
4
  import { defaultProps } from './props/defaultProps';
5
5
  import { propTypes } from './props/propTypes';
6
6
  /**** Components ****/
7
7
 
8
+ import useEffectCallOnlyAfterState from '@zohodesk/hooks/es/utils/useEffectCallOnlyAfterState';
8
9
  import TextEditor from '../TextEditor/TextEditor';
9
10
  import Textarea from '@zohodesk/components/es/v1/Textarea/Textarea';
10
11
  import VelocityAnimationGroup from '@zohodesk/components/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup';
@@ -12,192 +13,150 @@ import { editorContentValidate } from '../../../../utils/editorUtils';
12
13
  import style from './../../../../form/fields/TextEditorWrapper/TextEditorWrapper.module.css';
13
14
  /* eslint-disable react/no-deprecated */
14
15
 
15
- export default class TextEditorWrapper extends Component {
16
- constructor(props) {
17
- super(props);
18
- let {
19
- value,
20
- isEditorDefaultOpen
21
- } = props;
22
- this.state = {
23
- isEditorShow: isEditorDefaultOpen ? true : !!value
24
- };
25
- this.handleTextareaFocus = this.handleTextareaFocus.bind(this);
26
- this.toggleEdit = this.toggleEdit.bind(this);
27
- this.focusCallback = this.focusCallback.bind(this);
28
- }
29
-
30
- handleTextareaFocus() {
31
- let {
32
- isReadOnly,
33
- isDisabled
34
- } = this.props;
16
+ const TextEditorWrapper = props => {
17
+ const {
18
+ id,
19
+ onChange,
20
+ value,
21
+ onAttachmentUpload,
22
+ needEditor,
23
+ dataId,
24
+ isReadOnly,
25
+ isDisabled,
26
+ getRef,
27
+ textBoxSize,
28
+ textBoxVariant,
29
+ editorMode,
30
+ editorSize,
31
+ editorBorder,
32
+ EDITORURL,
33
+ isCustomScroll,
34
+ initCallback,
35
+ loadingComponent,
36
+ handleAlertMessage,
37
+ editorCallback,
38
+ editorBlurCallback,
39
+ editorOptions,
40
+ changeEditorContent,
41
+ shouldEditorUpdateContent,
42
+ setInlineAttachmentInProgress,
43
+ handleEditorDropUpload,
44
+ ImgLazyLoad,
45
+ i18nKeys,
46
+ isEditorDefaultOpen,
47
+ needInlineAttachment,
48
+ customProps,
49
+ dataSelectorId,
50
+ onFocus
51
+ } = props;
52
+ const {
53
+ Textarea1Props = {},
54
+ Textarea2Props = {},
55
+ TextEditorProps = {}
56
+ } = customProps;
57
+ const [isEditorShow, setIsEditorShow] = useState(isEditorDefaultOpen ? true : !!value);
58
+ const [isEditorFocus, setIsEditorFocus] = useState(false);
59
+ const defaultObj = {
60
+ needEditorFocus: !value
61
+ };
62
+ const editorOptionsObject = Object.assign(defaultObj, editorOptions);
35
63
 
64
+ const handleTextareaFocus = () => {
36
65
  if (!isReadOnly && !isDisabled) {
37
- this.setState({
38
- isEditorShow: true
39
- }, () => {
40
- setTimeout(() => {
41
- editor[this.props.id].squireInstance.focus();
42
- }, 300);
43
- });
66
+ setIsEditorShow(true);
67
+ setTimeout(() => {
68
+ editor[id].squireInstance.focus();
69
+ }, 300);
44
70
  }
45
- }
71
+ };
46
72
 
47
- toggleEdit(value) {
48
- this.setState({
49
- isEditorShow: value
50
- });
51
- }
73
+ const toggleEdit = value => {
74
+ setIsEditorShow(value);
75
+ };
52
76
 
53
- focusCallback() {
54
- let {
55
- onFocus
56
- } = this.props;
57
- this.setState({
58
- isEditorFocus: true
59
- });
77
+ const focusCallback = () => {
78
+ setIsEditorFocus(true);
60
79
  onFocus && onFocus();
61
- }
62
-
63
- componentWillReceiveProps(np) {
64
- let {
65
- id,
66
- value
67
- } = this.props;
80
+ };
68
81
 
69
- if (np.value || typeof editor != 'undefined' && editorContentValidate(editor[id])) {
70
- this.setState({
71
- isEditorShow: true
72
- });
82
+ useEffectCallOnlyAfterState(() => {
83
+ if (value || typeof editor !== 'undefined' && editorContentValidate(editor[id])) {
84
+ setIsEditorShow(true);
73
85
  } else {
74
- if (!this.state.isEditorFocus && !this.props.isEditorDefaultOpen) {
75
- this.setState({
76
- isEditorShow: false
77
- });
86
+ if (!isEditorFocus && !isEditorDefaultOpen) {
87
+ setIsEditorShow(false);
78
88
  }
79
- } // if (np.value !== value && np.value == '') {
80
- // editor[id].setContent('');
81
- // }
82
-
83
- }
84
-
85
- render() {
86
- let {
87
- isEditorShow
88
- } = this.state;
89
- let {
90
- id,
91
- onChange,
92
- value,
93
- onAttachmentUpload,
94
- needEditor,
95
- dataId,
96
- isReadOnly,
97
- isDisabled,
98
- getRef,
99
- textBoxSize,
100
- textBoxVariant,
101
- editorMode,
102
- editorSize,
103
- editorBorder,
104
- EDITORURL,
105
- isCustomScroll,
106
- initCallback,
107
- loadingComponent,
108
- handleAlertMessage,
109
- editorCallback,
110
- editorBlurCallback,
111
- editorOptions,
112
- changeEditorContent,
113
- shouldEditorUpdateContent,
114
- setInlineAttachmentInProgress,
115
- handleEditorDropUpload,
116
- ImgLazyLoad,
117
- i18nKeys,
118
- isEditorDefaultOpen,
119
- needInlineAttachment,
120
- customProps,
121
- dataSelectorId
122
- } = this.props;
123
- const {
124
- Textarea1Props = {},
125
- Textarea2Props = {},
126
- TextEditorProps = {}
127
- } = customProps;
128
- let defaultObj = {
129
- needEditorFocus: !value
130
- };
131
- let editorOptionsObject = Object.assign(defaultObj, editorOptions);
132
- return /*#__PURE__*/React.createElement("div", {
133
- className: style.container,
134
- "data-selector-id": dataSelectorId
135
- }, !isEditorShow ? /*#__PURE__*/React.createElement(Textarea, _extends({
136
- onFocus: this.handleTextareaFocus,
137
- text: value,
138
- animated: !needEditor,
139
- onChange: onChange,
140
- dataId: dataId,
141
- isReadOnly: isReadOnly,
142
- isDisabled: isDisabled,
143
- needEffect: !(isReadOnly || isDisabled),
144
- getRef: getRef,
145
- size: textBoxSize,
146
- variant: textBoxVariant,
147
- customClass: style.textBox
148
- }, Textarea1Props)) : null, /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
149
- name: "slideDown",
150
- runOnMount: true,
151
- enterDuration: '300',
152
- exitDuration: '400',
153
- isActive: isEditorShow,
154
- component: "div"
155
- }, /*#__PURE__*/React.createElement("div", {
156
- className: style.textEditor
157
- }, isEditorShow && needEditor ? /*#__PURE__*/React.createElement(TextEditor, _extends({
158
- id: id,
159
- value: value,
160
- onChange: !isReadOnly && !isDisabled ? onChange : null,
161
- editorOptions: editorOptionsObject,
162
- onUpload: onAttachmentUpload,
163
- editorMode: editorMode,
164
- type: editorSize,
165
- border: editorBorder,
166
- dataId: dataId,
167
- getRef: getRef,
168
- plainTextSwitchCallback: !isReadOnly && !isDisabled ? onChange : null,
169
- EDITORURL: EDITORURL,
170
- isCustomScroll: isCustomScroll,
171
- initCallback: initCallback,
172
- loadingComponent: loadingComponent,
173
- handleAlertMessage: handleAlertMessage,
174
- toggleEdit: this.toggleEdit,
175
- isEditorDefaultOpen: isEditorDefaultOpen,
176
- editorCallback: editorCallback,
177
- i18nKeys: i18nKeys,
178
- ImgLazyLoad: ImgLazyLoad,
179
- blurCallback: editorBlurCallback,
180
- changeEditorContent: changeEditorContent,
181
- shouldUpdateContent: shouldEditorUpdateContent,
182
- setInlineAttachmentInProgress: setInlineAttachmentInProgress,
183
- handleDropUpload: handleEditorDropUpload,
184
- onFocus: this.focusCallback,
185
- needInlineAttachment: needInlineAttachment
186
- }, TextEditorProps)) : /*#__PURE__*/React.createElement(Textarea, _extends({
187
- onFocus: this.handleTextareaFocus,
188
- text: value,
189
- animated: !needEditor,
190
- onChange: onChange,
191
- dataId: dataId,
192
- isReadOnly: isReadOnly,
193
- isDisabled: isDisabled,
194
- needEffect: !(isReadOnly || isDisabled),
195
- getRef: getRef,
196
- size: textBoxSize,
197
- variant: textBoxVariant
198
- }, Textarea2Props)))));
199
- }
89
+ }
90
+ }, [value, id, isEditorDefaultOpen]);
91
+ return /*#__PURE__*/React.createElement("div", {
92
+ className: style.container,
93
+ "data-selector-id": dataSelectorId
94
+ }, !isEditorShow ? /*#__PURE__*/React.createElement(Textarea, _extends({
95
+ onFocus: handleTextareaFocus,
96
+ text: value,
97
+ animated: !needEditor,
98
+ onChange: onChange,
99
+ dataId: dataId,
100
+ isReadOnly: isReadOnly,
101
+ isDisabled: isDisabled,
102
+ needEffect: !(isReadOnly || isDisabled),
103
+ getRef: getRef,
104
+ size: textBoxSize,
105
+ variant: textBoxVariant,
106
+ customClass: style.textBox
107
+ }, Textarea1Props)) : null, /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
108
+ name: "slideDown",
109
+ runOnMount: true,
110
+ enterDuration: '300',
111
+ exitDuration: '400',
112
+ isActive: isEditorShow,
113
+ component: "div"
114
+ }, /*#__PURE__*/React.createElement("div", {
115
+ className: style.textEditor
116
+ }, isEditorShow && needEditor ? /*#__PURE__*/React.createElement(TextEditor, _extends({
117
+ id: id,
118
+ value: value,
119
+ onChange: !isReadOnly && !isDisabled ? onChange : null,
120
+ editorOptions: editorOptionsObject,
121
+ onUpload: onAttachmentUpload,
122
+ editorMode: editorMode,
123
+ type: editorSize,
124
+ border: editorBorder,
125
+ dataId: dataId,
126
+ getRef: getRef,
127
+ plainTextSwitchCallback: !isReadOnly && !isDisabled ? onChange : null,
128
+ EDITORURL: EDITORURL,
129
+ isCustomScroll: isCustomScroll,
130
+ initCallback: initCallback,
131
+ loadingComponent: loadingComponent,
132
+ handleAlertMessage: handleAlertMessage,
133
+ toggleEdit: toggleEdit,
134
+ isEditorDefaultOpen: isEditorDefaultOpen,
135
+ editorCallback: editorCallback,
136
+ i18nKeys: i18nKeys,
137
+ ImgLazyLoad: ImgLazyLoad,
138
+ blurCallback: editorBlurCallback,
139
+ changeEditorContent: changeEditorContent,
140
+ shouldUpdateContent: shouldEditorUpdateContent,
141
+ setInlineAttachmentInProgress: setInlineAttachmentInProgress,
142
+ handleDropUpload: handleEditorDropUpload,
143
+ onFocus: focusCallback,
144
+ needInlineAttachment: needInlineAttachment
145
+ }, TextEditorProps)) : /*#__PURE__*/React.createElement(Textarea, _extends({
146
+ onFocus: handleTextareaFocus,
147
+ text: value,
148
+ animated: !needEditor,
149
+ onChange: onChange,
150
+ dataId: dataId,
151
+ isReadOnly: isReadOnly,
152
+ isDisabled: isDisabled,
153
+ needEffect: !(isReadOnly || isDisabled),
154
+ getRef: getRef,
155
+ size: textBoxSize,
156
+ variant: textBoxVariant
157
+ }, Textarea2Props)))));
158
+ };
200
159
 
201
- }
160
+ export default TextEditorWrapper;
202
161
  TextEditorWrapper.propTypes = propTypes;
203
162
  TextEditorWrapper.defaultProps = defaultProps;