@zohodesk/dot 1.2.2 → 1.2.4

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 (305) hide show
  1. package/.cli/PropLessFiles.html +1 -1
  2. package/.cli/propValidation_report.html +1 -1
  3. package/README.md +9 -0
  4. package/coverage/ExternalLink/ExternalLink.js.html +1 -1
  5. package/coverage/ExternalLink/ExternalLink.module.css.html +1 -1
  6. package/coverage/ExternalLink/index.html +1 -1
  7. package/coverage/ExternalLink/props/defaultProps.js.html +1 -1
  8. package/coverage/ExternalLink/props/index.html +1 -1
  9. package/coverage/ExternalLink/props/propTypes.js.html +1 -1
  10. package/coverage/Image/Image.js.html +1 -1
  11. package/coverage/Image/Image.module.css.html +1 -1
  12. package/coverage/Image/index.html +1 -1
  13. package/coverage/Image/props/defaultProps.js.html +1 -1
  14. package/coverage/Image/props/index.html +1 -1
  15. package/coverage/Image/props/propTypes.js.html +1 -1
  16. package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.js.html +1 -1
  17. package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.module.css.html +1 -1
  18. package/coverage/avatar/AvatarWithTeam/index.html +1 -1
  19. package/coverage/avatar/AvatarWithTeam/props/defaultProps.js.html +1 -1
  20. package/coverage/avatar/AvatarWithTeam/props/index.html +1 -1
  21. package/coverage/avatar/AvatarWithTeam/props/propTypes.js.html +1 -1
  22. package/coverage/coverage-final.json +12 -12
  23. package/coverage/coverage-summary.json +12 -12
  24. package/coverage/index.html +1 -1
  25. package/es/Drawer/Drawer.js +10 -10
  26. package/es/TagWithIcon/props/propTypes.js +1 -1
  27. package/es/dropdown/ToggleDropDown/ToggleDropDown.js +5 -2
  28. package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +7 -3
  29. package/es/layout/SubtabLayout/props/propTypes.js +1 -1
  30. package/es/list/status/StatusDropdown/StatusDropdown.js +4 -1
  31. package/es/list/status/StatusDropdown/props/propTypes.js +2 -1
  32. package/es/lookup/Lookup/Lookup.js +10 -10
  33. package/es/lookup/header/ViewDropDown/ViewDropDown.js +2 -1
  34. package/es/setup/helptips/ListGroup/ListGroup.js +1 -1
  35. package/es/v1/Attachment/Attachment.js +88 -0
  36. package/es/v1/AttachmentViewer/AttachmentImage.js +79 -0
  37. package/es/v1/AttachmentViewer/AttachmentViewer.js +541 -0
  38. package/es/v1/ChannelIcon/ChannelIcon.js +1 -1
  39. package/es/v1/Drawer/Drawer.js +11 -11
  40. package/es/v1/FlipCard/FlipCard.js +3 -3
  41. package/es/v1/FreezeLayer/FreezeLayer.js +74 -0
  42. package/es/v1/Image/Image.js +39 -0
  43. package/es/v1/Link/Link.js +2 -1
  44. package/es/v1/Loader/Loader.js +21 -0
  45. package/es/v1/Message/Message.js +118 -0
  46. package/es/v1/MessageBanner/MessageBanner.js +1 -1
  47. package/es/v1/PlusIcon/PlusIcon.js +44 -0
  48. package/es/v1/Separator/Separator.js +60 -0
  49. package/es/v1/ToastMessage/ToastMessage.js +203 -0
  50. package/es/v1/Upload/Upload.js +76 -0
  51. package/es/v1/actions/AutoClose.js +43 -0
  52. package/es/v1/alert/index.js +2 -0
  53. package/es/v1/avatar/AvatarClose/AvatarClose.js +53 -0
  54. package/es/v1/avatar/AvatarCollision/AvatarCollision.js +62 -0
  55. package/es/v1/avatar/AvatarIcon/AvatarIcon.js +54 -0
  56. package/es/v1/avatar/AvatarStatus/AvatarStatus.js +72 -0
  57. package/es/v1/avatar/AvatarThread/AvatarThread.js +79 -0
  58. package/es/v1/avatar/AvatarUser/AvatarUser.js +116 -0
  59. package/es/v1/avatar/AvatarWithTeam/AvatarWithTeam.js +98 -0
  60. package/es/v1/avatar/index.js +7 -0
  61. package/es/v1/dropdown/ToggleDropDown/ToggleDropDown.js +861 -0
  62. package/es/v1/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
  63. package/es/v1/errorstate/Inconvenience/Inconvenience.js +86 -0
  64. package/es/v1/errorstate/LinkText/LinkText.js +29 -0
  65. package/es/v1/errorstate/NoRequestFound/NoRequestFound.js +84 -0
  66. package/es/v1/errorstate/PermissionPlay/PermissionPlay.js +83 -0
  67. package/es/v1/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +84 -0
  68. package/es/v1/errorstate/UnableToProcess/UnableToProcess.js +86 -0
  69. package/es/v1/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +84 -0
  70. package/es/v1/errorstate/WillBack/WillBack.js +75 -0
  71. package/es/v1/errorstate/index.js +8 -0
  72. package/es/v1/form/fields/CheckBoxField/CheckBoxField.js +141 -0
  73. package/es/v1/form/fields/CurrencyField/CurrencyField.js +183 -0
  74. package/es/v1/form/fields/DateField/DateField.js +195 -0
  75. package/es/v1/form/fields/FieldContainer/FieldContainer.js +71 -0
  76. package/es/v1/form/fields/MultiSelectField/MultiSelectField.js +213 -0
  77. package/es/v1/form/fields/PhoneField/PhoneField.js +189 -0
  78. package/es/v1/form/fields/RadioField/RadioField.js +116 -0
  79. package/es/v1/form/fields/SelectField/SelectField.js +183 -0
  80. package/es/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +292 -0
  81. package/es/v1/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +258 -0
  82. package/es/v1/form/fields/TextBoxField/TextBoxField.js +164 -0
  83. package/es/v1/form/fields/TextEditor/TextEditor.js +418 -0
  84. package/es/v1/form/fields/TextEditorField/TextEditorField.js +178 -0
  85. package/es/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +203 -0
  86. package/es/v1/form/fields/TextareaField/TextareaField.js +161 -0
  87. package/es/v1/form/fields/ValidationMessage/ValidationMessage.js +58 -0
  88. package/es/v1/form/fields/index.js +16 -0
  89. package/es/v1/form/layout/Field/Field.js +33 -0
  90. package/es/v1/form/layout/Section/Section.js +37 -0
  91. package/es/v1/form/layout/index.js +2 -0
  92. package/es/v1/layout/SetupDetailLayout/SetupDetailLayout.js +217 -0
  93. package/es/v1/layout/SetupDetailLayout/index.js +4 -0
  94. package/es/v1/layout/SubtabLayout/SubtabLayout.js +144 -0
  95. package/es/v1/layout/SubtabLayout/index.js +4 -0
  96. package/es/v1/list/AvatarFlip/AvatarFlip.js +76 -0
  97. package/es/v1/list/BluePrintStatus/BluePrintStatus.js +28 -0
  98. package/es/v1/list/Comment/Comment.js +45 -0
  99. package/es/v1/list/DepartmentDropDown/DepartmentDropDown.js +100 -0
  100. package/es/v1/list/Dot/Dot.js +22 -0
  101. package/es/v1/list/DotNew/DotNew.js +29 -0
  102. package/es/v1/list/GridStencils/GridStencils.js +34 -0
  103. package/es/v1/list/Icons/AddNewIcon.js +28 -0
  104. package/es/v1/list/Icons/CompleteIcon.js +30 -0
  105. package/es/v1/list/Icons/DeleteIcon.js +31 -0
  106. package/es/v1/list/Icons/EditIcon.js +31 -0
  107. package/es/v1/list/Icons/FloatingIcons.js +30 -0
  108. package/es/v1/list/Icons/ReadUnreadIcon.js +35 -0
  109. package/es/v1/list/Icons/SmartIcon.js +28 -0
  110. package/es/v1/list/Icons/index.js +7 -0
  111. package/es/v1/list/ListLayout/ListLayout.js +83 -0
  112. package/es/v1/list/ListStencils/ListStencils.js +47 -0
  113. package/es/v1/list/SecondaryText/AccountName.js +85 -0
  114. package/es/v1/list/SecondaryText/ContactName.js +85 -0
  115. package/es/v1/list/SecondaryText/DepartmentText.js +30 -0
  116. package/es/v1/list/SecondaryText/Email.js +55 -0
  117. package/es/v1/list/SecondaryText/HappinessRating.js +31 -0
  118. package/es/v1/list/SecondaryText/PhoneNumber.js +59 -0
  119. package/es/v1/list/SecondaryText/PriorityText.js +33 -0
  120. package/es/v1/list/SecondaryText/SecondaryText.js +40 -0
  121. package/es/v1/list/SecondaryText/StatusText.js +34 -0
  122. package/es/v1/list/SecondaryText/TicketId.js +53 -0
  123. package/es/v1/list/SecondaryText/Website.js +43 -0
  124. package/es/v1/list/SecondaryText/index.js +11 -0
  125. package/es/v1/list/SecondryPanel/SecondryPanel.js +105 -0
  126. package/es/v1/list/SentimentStatus/SentimentStatus.js +34 -0
  127. package/es/v1/list/Subject/Subject.js +57 -0
  128. package/es/v1/list/TagNew/TagNew.js +33 -0
  129. package/es/v1/list/Thread/Thread.js +43 -0
  130. package/es/v1/list/UserTime/UserTime.js +83 -0
  131. package/es/v1/list/index.js +17 -0
  132. package/es/v1/list/status/StatusDropdown/StatusDropdown.js +465 -0
  133. package/es/v1/list/status/StatusListItem/StatusListItem.js +122 -0
  134. package/es/v1/list/status/index.js +2 -0
  135. package/es/v1/lookup/EmptyPage/EmptyPage.js +65 -0
  136. package/es/v1/lookup/Lookup/Lookup.js +12 -10
  137. package/es/v1/lookup/Section/Section.js +25 -0
  138. package/es/v1/lookup/header/ViewDropDown/ViewDropDown.js +176 -0
  139. package/es/v1/lookup/header/index.js +5 -0
  140. package/es/v1/setup/header/Button/Button.js +36 -0
  141. package/es/v1/setup/header/Link/Link.js +44 -0
  142. package/es/v1/setup/header/Search/Search.js +81 -0
  143. package/es/v1/setup/header/Views/Views.js +46 -0
  144. package/es/v1/setup/header/index.js +4 -0
  145. package/es/v1/setup/helptips/Description/Description.js +24 -0
  146. package/es/v1/setup/helptips/Link/Link.js +41 -0
  147. package/es/v1/setup/helptips/ListGroup/ListGroup.js +39 -0
  148. package/es/v1/setup/helptips/Title/Title.js +24 -0
  149. package/es/v1/setup/helptips/index.js +4 -0
  150. package/es/v1/setup/index.js +6 -0
  151. package/es/v1/setup/table/index.js +5 -0
  152. package/es/v1/svg/PlusIcon.js +32 -0
  153. package/es/v1/svg/SnippetIcon.js +34 -0
  154. package/es/v1/svg/TemplateIcon.js +35 -0
  155. package/es/v1/svg/index.js +3 -0
  156. package/es/v1/version2/alertIcons/index.js +8 -0
  157. package/es/v1/version2/index.js +12 -0
  158. package/es/v1/version2/lookup/AlertHeader/AlertHeader.js +79 -0
  159. package/es/v1/version2/lookup/AlertLookup/AlertLookup.js +17 -5
  160. package/es/v1/version2/notification/DesktopNotification/DesktopNotification.js +164 -0
  161. package/lib/Drawer/Drawer.js +15 -15
  162. package/lib/TagWithIcon/props/propTypes.js +1 -1
  163. package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +5 -3
  164. package/lib/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +8 -5
  165. package/lib/layout/SubtabLayout/props/propTypes.js +1 -1
  166. package/lib/list/status/StatusDropdown/StatusDropdown.js +4 -3
  167. package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
  168. package/lib/lookup/Lookup/Lookup.js +15 -15
  169. package/lib/lookup/header/ViewDropDown/ViewDropDown.js +2 -1
  170. package/lib/setup/helptips/ListGroup/ListGroup.js +1 -1
  171. package/lib/v1/Attachment/Attachment.js +140 -0
  172. package/lib/v1/AttachmentViewer/AttachmentImage.js +124 -0
  173. package/lib/v1/AttachmentViewer/AttachmentViewer.js +625 -0
  174. package/lib/v1/ChannelIcon/ChannelIcon.js +1 -1
  175. package/lib/v1/Drawer/Drawer.js +16 -16
  176. package/lib/v1/FlipCard/FlipCard.js +3 -3
  177. package/lib/v1/FreezeLayer/FreezeLayer.js +94 -0
  178. package/lib/v1/Image/Image.js +89 -0
  179. package/lib/v1/Link/Link.js +2 -1
  180. package/lib/v1/Loader/Loader.js +70 -0
  181. package/lib/v1/Message/Message.js +170 -0
  182. package/lib/v1/MessageBanner/MessageBanner.js +1 -1
  183. package/lib/v1/PlusIcon/PlusIcon.js +91 -0
  184. package/lib/v1/Separator/Separator.js +107 -0
  185. package/lib/v1/ToastMessage/ToastMessage.js +246 -0
  186. package/lib/v1/Upload/Upload.js +128 -0
  187. package/lib/v1/actions/AutoClose.js +75 -0
  188. package/lib/v1/alert/index.js +23 -0
  189. package/lib/v1/avatar/AvatarClose/AvatarClose.js +101 -0
  190. package/lib/v1/avatar/AvatarCollision/AvatarCollision.js +110 -0
  191. package/lib/v1/avatar/AvatarIcon/AvatarIcon.js +106 -0
  192. package/lib/v1/avatar/AvatarStatus/AvatarStatus.js +119 -0
  193. package/lib/v1/avatar/AvatarThread/AvatarThread.js +130 -0
  194. package/lib/v1/avatar/AvatarUser/AvatarUser.js +167 -0
  195. package/lib/v1/avatar/AvatarWithTeam/AvatarWithTeam.js +154 -0
  196. package/lib/v1/avatar/index.js +63 -0
  197. package/lib/v1/dropdown/ToggleDropDown/ToggleDropDown.js +932 -0
  198. package/lib/v1/emptystate/CommonEmptyState/CommonEmptyState.js +1 -0
  199. package/lib/v1/errorstate/Inconvenience/Inconvenience.js +137 -0
  200. package/lib/v1/errorstate/LinkText/LinkText.js +80 -0
  201. package/lib/v1/errorstate/NoRequestFound/NoRequestFound.js +135 -0
  202. package/lib/v1/errorstate/PermissionPlay/PermissionPlay.js +134 -0
  203. package/lib/v1/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +135 -0
  204. package/lib/v1/errorstate/UnableToProcess/UnableToProcess.js +137 -0
  205. package/lib/v1/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +135 -0
  206. package/lib/v1/errorstate/WillBack/WillBack.js +125 -0
  207. package/lib/v1/errorstate/index.js +71 -0
  208. package/lib/v1/form/fields/CheckBoxField/CheckBoxField.js +197 -0
  209. package/lib/v1/form/fields/CurrencyField/CurrencyField.js +234 -0
  210. package/lib/v1/form/fields/DateField/DateField.js +249 -0
  211. package/lib/v1/form/fields/FieldContainer/FieldContainer.js +118 -0
  212. package/lib/v1/form/fields/MultiSelectField/MultiSelectField.js +268 -0
  213. package/lib/v1/form/fields/PhoneField/PhoneField.js +236 -0
  214. package/lib/v1/form/fields/RadioField/RadioField.js +169 -0
  215. package/lib/v1/form/fields/SelectField/SelectField.js +236 -0
  216. package/lib/v1/form/fields/TagsMultiSelect/TagsMultiSelect.js +346 -0
  217. package/lib/v1/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +299 -0
  218. package/lib/v1/form/fields/TextBoxField/TextBoxField.js +219 -0
  219. package/lib/v1/form/fields/TextEditor/TextEditor.js +463 -0
  220. package/lib/v1/form/fields/TextEditorField/TextEditorField.js +230 -0
  221. package/lib/v1/form/fields/TextEditorWrapper/TextEditorWrapper.js +256 -0
  222. package/lib/v1/form/fields/TextareaField/TextareaField.js +215 -0
  223. package/lib/v1/form/fields/ValidationMessage/ValidationMessage.js +110 -0
  224. package/lib/{docs/formDocs.js → v1/form/fields/index.js} +33 -25
  225. package/lib/v1/form/layout/Field/Field.js +87 -0
  226. package/lib/v1/form/layout/Section/Section.js +86 -0
  227. package/lib/v1/form/layout/index.js +23 -0
  228. package/lib/v1/layout/SetupDetailLayout/SetupDetailLayout.js +305 -0
  229. package/lib/v1/layout/SetupDetailLayout/index.js +37 -0
  230. package/lib/v1/layout/SubtabLayout/SubtabLayout.js +245 -0
  231. package/lib/v1/layout/SubtabLayout/index.js +37 -0
  232. package/lib/v1/list/AvatarFlip/AvatarFlip.js +131 -0
  233. package/lib/v1/list/BluePrintStatus/BluePrintStatus.js +73 -0
  234. package/lib/v1/list/Comment/Comment.js +98 -0
  235. package/lib/v1/list/DepartmentDropDown/DepartmentDropDown.js +157 -0
  236. package/lib/v1/list/Dot/Dot.js +72 -0
  237. package/lib/v1/list/DotNew/DotNew.js +79 -0
  238. package/lib/v1/list/GridStencils/GridStencils.js +83 -0
  239. package/lib/v1/list/Icons/AddNewIcon.js +79 -0
  240. package/lib/v1/list/Icons/CompleteIcon.js +81 -0
  241. package/lib/v1/list/Icons/DeleteIcon.js +82 -0
  242. package/lib/v1/list/Icons/EditIcon.js +82 -0
  243. package/lib/v1/list/Icons/FloatingIcons.js +87 -0
  244. package/lib/v1/list/Icons/ReadUnreadIcon.js +87 -0
  245. package/lib/v1/list/Icons/SmartIcon.js +83 -0
  246. package/lib/v1/list/Icons/index.js +63 -0
  247. package/lib/v1/list/ListLayout/ListLayout.js +145 -0
  248. package/lib/v1/list/ListStencils/ListStencils.js +96 -0
  249. package/lib/v1/list/SecondaryText/AccountName.js +136 -0
  250. package/lib/v1/list/SecondaryText/ContactName.js +144 -0
  251. package/lib/v1/list/SecondaryText/DepartmentText.js +79 -0
  252. package/lib/v1/list/SecondaryText/Email.js +103 -0
  253. package/lib/v1/list/SecondaryText/HappinessRating.js +81 -0
  254. package/lib/v1/list/SecondaryText/PhoneNumber.js +107 -0
  255. package/lib/v1/list/SecondaryText/PriorityText.js +83 -0
  256. package/lib/v1/list/SecondaryText/SecondaryText.js +88 -0
  257. package/lib/v1/list/SecondaryText/StatusText.js +84 -0
  258. package/lib/v1/list/SecondaryText/TicketId.js +104 -0
  259. package/lib/v1/list/SecondaryText/Website.js +91 -0
  260. package/lib/v1/list/SecondaryText/index.js +95 -0
  261. package/lib/v1/list/SecondryPanel/SecondryPanel.js +205 -0
  262. package/lib/v1/list/SentimentStatus/SentimentStatus.js +80 -0
  263. package/lib/v1/list/Subject/Subject.js +108 -0
  264. package/lib/v1/list/TagNew/TagNew.js +83 -0
  265. package/lib/v1/list/Thread/Thread.js +95 -0
  266. package/lib/v1/list/UserTime/UserTime.js +136 -0
  267. package/lib/v1/list/index.js +173 -0
  268. package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +541 -0
  269. package/lib/v1/list/status/StatusListItem/StatusListItem.js +168 -0
  270. package/lib/v1/list/status/index.js +23 -0
  271. package/lib/v1/lookup/EmptyPage/EmptyPage.js +120 -0
  272. package/lib/v1/lookup/Lookup/Lookup.js +17 -15
  273. package/lib/v1/lookup/Section/Section.js +75 -0
  274. package/lib/v1/lookup/header/ViewDropDown/ViewDropDown.js +221 -0
  275. package/lib/v1/lookup/header/index.js +47 -0
  276. package/lib/v1/setup/header/Button/Button.js +83 -0
  277. package/lib/v1/setup/header/Link/Link.js +93 -0
  278. package/lib/v1/setup/header/Search/Search.js +126 -0
  279. package/lib/v1/setup/header/Views/Views.js +93 -0
  280. package/lib/v1/setup/header/index.js +39 -0
  281. package/lib/v1/setup/helptips/Description/Description.js +68 -0
  282. package/lib/v1/setup/helptips/Link/Link.js +88 -0
  283. package/lib/v1/setup/helptips/ListGroup/ListGroup.js +88 -0
  284. package/lib/v1/setup/helptips/Title/Title.js +68 -0
  285. package/lib/v1/setup/helptips/index.js +39 -0
  286. package/lib/v1/setup/index.js +24 -0
  287. package/lib/v1/setup/table/index.js +47 -0
  288. package/lib/v1/svg/PlusIcon.js +82 -0
  289. package/lib/v1/svg/SnippetIcon.js +84 -0
  290. package/lib/v1/svg/TemplateIcon.js +85 -0
  291. package/lib/v1/svg/index.js +31 -0
  292. package/lib/v1/version2/alertIcons/index.js +71 -0
  293. package/lib/v1/version2/index.js +58 -0
  294. package/lib/v1/version2/lookup/AlertHeader/AlertHeader.js +104 -0
  295. package/lib/v1/version2/lookup/AlertLookup/AlertLookup.js +17 -5
  296. package/lib/v1/version2/notification/DesktopNotification/DesktopNotification.js +193 -0
  297. package/package.json +9 -9
  298. package/result.json +1 -1
  299. package/es/docs/formDocs.js +0 -15
  300. package/es/docs/generalDocs.js +0 -63
  301. package/es/docs/lookupDocs.js +0 -17
  302. package/es/docs/setupDocs.js +0 -11
  303. package/lib/docs/generalDocs.js +0 -479
  304. package/lib/docs/lookupDocs.js +0 -135
  305. package/lib/docs/setupDocs.js +0 -95
@@ -0,0 +1,164 @@
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
+ /**** Libraries ****/
4
+ import React, { PureComponent } from 'react';
5
+ import { defaultProps } from '../../../../form/fields/TextBoxField/props/defaultProps';
6
+ import { propTypes } from '../../../../form/fields/TextBoxField/props/propTypes';
7
+ /**** Components ****/
8
+
9
+ import Label from '@zohodesk/components/lib/Label/Label';
10
+ import TextBoxIcon from '@zohodesk/components/lib/TextBoxIcon/TextBoxIcon';
11
+ import ValidationMessage from '../ValidationMessage/ValidationMessage';
12
+ import { getUniqueId } from '@zohodesk/components/lib/Provider/IdProvider';
13
+ import FieldContainer from '../FieldContainer/FieldContainer';
14
+ /**** CSS ****/
15
+
16
+ import style from '../../../../form/fields/Fields.module.css';
17
+ export default class TextBoxField extends PureComponent {
18
+ constructor(props) {
19
+ super(props);
20
+ this.handleChange = this.handleChange.bind(this);
21
+ this.handleGetRef = this.handleGetRef.bind(this); // this.handleLabelClick = this.handleLabelClick.bind(this);
22
+
23
+ this.getNextId = getUniqueId(this);
24
+ }
25
+
26
+ handleChange(value) {
27
+ let {
28
+ id,
29
+ onChange
30
+ } = this.props;
31
+ onChange && onChange(id, value);
32
+ }
33
+
34
+ handleGetRef(el) {
35
+ let {
36
+ getRef,
37
+ id
38
+ } = this.props;
39
+ this.textBox = el;
40
+ getRef && getRef(el, id);
41
+ } // handleLabelClick() {
42
+ // // let { isFocusOnLabelClick } = this.props;
43
+ // // if (isFocusOnLabelClick && this.textBox && this.textBox.focus) {
44
+ // // this.textBox.focus();
45
+ // // }
46
+ // }
47
+
48
+
49
+ render() {
50
+ let {
51
+ labelName,
52
+ id,
53
+ textBoxSize,
54
+ textBoxVariant,
55
+ textBoxType,
56
+ isMandatory,
57
+ validationMessage,
58
+ validationPalette,
59
+ maxLength,
60
+ isReadOnly,
61
+ value,
62
+ errorType,
63
+ isDisabled,
64
+ title,
65
+ onBlur,
66
+ dataId,
67
+ dataSelectorId,
68
+ validationRuleMessage,
69
+ validationRulePalette,
70
+ onKeyDown,
71
+ placeHolder,
72
+ infoText,
73
+ borderColor,
74
+ fieldSize,
75
+ labelPalette,
76
+ labelCustomClass,
77
+ htmlId,
78
+ lockedInfoText,
79
+ isLocked,
80
+ needReadOnlyStyle,
81
+ isClickable,
82
+ onFocus,
83
+ ePhiData,
84
+ children,
85
+ customProps,
86
+ renderLabelProps
87
+ } = this.props;
88
+ const {
89
+ LabelProps = {},
90
+ TextBoxIconProps = {},
91
+ ValidationMessageProps1 = {},
92
+ ValidationMessageProps2 = {}
93
+ } = customProps;
94
+ let uniqueId = htmlId ? htmlId : this.getNextId();
95
+ return /*#__PURE__*/React.createElement("div", {
96
+ className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? style.readonly : ''}`,
97
+ "data-title": isDisabled ? title : null,
98
+ "data-selector-id": dataSelectorId
99
+ }, labelName && /*#__PURE__*/React.createElement(FieldContainer, {
100
+ infoText: infoText,
101
+ isLocked: isLocked,
102
+ lockedInfoText: lockedInfoText,
103
+ ePhiData: ePhiData,
104
+ dataId: dataId,
105
+ renderProps: renderLabelProps
106
+ }, /*#__PURE__*/React.createElement(Label, _extends({
107
+ text: labelName,
108
+ size: fieldSize === 'small' ? 'small' : 'medium',
109
+ palette: isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette,
110
+ customClass: `${style.fieldLabel} ${labelCustomClass} ${isMandatory ? style.labelMandatory : ''}`,
111
+ htmlFor: uniqueId,
112
+ dataId: isDisabled ? `${dataId}_label_disabled` : isMandatory ? `${dataId}_label_mandatory` : `${dataId}_label`
113
+ }, LabelProps, {
114
+ id: labelName
115
+ }))), /*#__PURE__*/React.createElement("div", {
116
+ className: `${style.fieldContainer} ${labelName ? style[`fieldMargin_${fieldSize}`] : ''}`
117
+ }, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
118
+ htmlId: uniqueId,
119
+ id: id,
120
+ type: textBoxType,
121
+ variant: textBoxVariant,
122
+ size: fieldSize === 'medium' ? textBoxSize : 'xsmall',
123
+ maxLength: maxLength,
124
+ isReadOnly: isReadOnly,
125
+ inputRef: this.handleGetRef,
126
+ value: value,
127
+ onChange: this.handleChange,
128
+ dataId: dataId,
129
+ onBlur: onBlur,
130
+ onKeyDown: onKeyDown,
131
+ placeHolder: placeHolder,
132
+ borderColor: borderColor,
133
+ onFocus: onFocus,
134
+ isDisabled: isDisabled,
135
+ needEffect: isReadOnly || isDisabled ? false : true,
136
+ isClickable: isClickable,
137
+ needReadOnlyStyle: needReadOnlyStyle
138
+ }, TextBoxIconProps, {
139
+ a11y: {
140
+ ariaLabelledby: labelName
141
+ }
142
+ }), children ? children : null), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
143
+ text: validationMessage,
144
+ palette: validationPalette,
145
+ type: errorType,
146
+ dataId: `${dataId}_ValidationMessage`,
147
+ htmlFor: uniqueId
148
+ }, ValidationMessageProps1)), validationRuleMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
149
+ text: validationRuleMessage,
150
+ palette: validationRulePalette,
151
+ type: errorType,
152
+ htmlFor: uniqueId,
153
+ dataId: `${dataId}_ValidationRuleMessage`
154
+ }, ValidationMessageProps2))));
155
+ }
156
+
157
+ }
158
+ TextBoxField.propTypes = propTypes;
159
+ TextBoxField.defaultProps = defaultProps; // if (__DOCS__) {
160
+ // TextBoxField.docs = {
161
+ // componentGroup: 'Form Fields',
162
+ // folderName: 'General'
163
+ // };
164
+ // }
@@ -0,0 +1,418 @@
1
+ /***** Libraries *****/
2
+ import React, { Component } from 'react';
3
+ import { defaultProps } from '../../../../form/fields/TextEditor/props/defaultProps';
4
+ import { propTypes } from '../../../../form/fields/TextEditor/props/propTypes';
5
+ import selectn from 'selectn';
6
+ import { Container, Box } from '@zohodesk/components/lib/Layout';
7
+ /***** Methods *****/
8
+
9
+ import { bind, editorContentValidate, fixEncoding, isFileNameSizeInvalid, isImageFormat, triggerKeyup, getRichEditorContent, changeContent, validateEditorContentOnInsertHtml, loadResource } from '../../../../utils/editorUtils'; //import './ZohoDeskEditor_Init';
10
+
11
+ /***** components *****/
12
+
13
+ import styles from '../../../../form/fields/TextEditor/TextEditor.module.css';
14
+ /* eslint-disable camelcase */
15
+
16
+ /* eslint-disable no-undef */
17
+
18
+ /* eslint-disable react/no-deprecated */
19
+
20
+ export default class TextEditor extends Component {
21
+ constructor(props) {
22
+ super(props);
23
+ this.state = {
24
+ isEditorLoad: false,
25
+ isResourceLoaded: false,
26
+ isEditorShow: false
27
+ };
28
+ let methods = ['editorCallback', 'handleUpload', 'handleChange', 'focusCallback', 'handleInlineUpload', 'handleDropUpload', 'blurCallback', 'handleGetContent', 'initializeEditor', 'clearEditorData', 'plainTextSwitchCallback', 'onWindowClick', 'toggleEditor'];
29
+ bind.apply(this, methods);
30
+ }
31
+
32
+ componentDidMount() {
33
+ this.mount = true;
34
+
35
+ if (typeof global.ZohoDeskEditor === 'undefined') {
36
+ loadResource(this.props.EDITORURL, 'js', 'ZohoDeskEditor').then(() => {
37
+ this.setState({
38
+ isResourceLoaded: true
39
+ });
40
+ });
41
+ } else {
42
+ this.setState({
43
+ isResourceLoaded: true
44
+ });
45
+ }
46
+
47
+ window.addEventListener('click', this.onWindowClick);
48
+ }
49
+
50
+ initializeEditor(id, mode) {
51
+ let {
52
+ value,
53
+ editorMode = '',
54
+ editorOptions = {},
55
+ needEditorFocus = true,
56
+ handleDropUpload,
57
+ fontFamily,
58
+ fontSize,
59
+ initCallback,
60
+ handleAlertMessage,
61
+ needInlineAttachment
62
+ } = this.props;
63
+
64
+ if (id && global.ZohoDeskEditor) {
65
+ let defaultObj = {
66
+ id,
67
+ content: fixEncoding(value),
68
+ callback: this.editorCallback,
69
+ imageuploadcallback: this.handleInlineUpload,
70
+ handleInlineDropImage: handleDropUpload ? this.handleDropUpload : undefined,
71
+ contentChanged: this.handleChange,
72
+ focusCallback: this.focusCallback,
73
+ lineHeight: 'Normal',
74
+ backgroundColor: 'transparent',
75
+ defaultfontsize: '14px',
76
+ allowTagsInsertHTML: ['iframe'],
77
+ allowAttrsInsertHTML: ['frameborder', 'allowfullscreen'],
78
+ needEditorFocus,
79
+ blurCallback: this.blurCallback,
80
+ mode,
81
+ handleAlertMessage: handleAlertMessage,
82
+ plainTextSwitchCallback: this.plainTextSwitchCallback,
83
+ imgAspect: true,
84
+ handleInlineDropImage: needInlineAttachment ? this.handleInlineUpload : null,
85
+ needInlineAttachHandling: needInlineAttachment,
86
+ hookOnInsertHTML: validateEditorContentOnInsertHtml,
87
+ needCustomPaste: function (event, editorObj) {
88
+ return true; // By default reply editor needs customPaste, so returning true.
89
+ },
90
+ htmlVersion: '<!Doctype html>'
91
+ };
92
+
93
+ if (!ZohoDeskEditor_Init.init) {
94
+ global.editorInitialize && global.editorInitialize();
95
+ }
96
+
97
+ defaultObj = Object.assign(defaultObj, editorOptions);
98
+ ZohoDeskEditor_Init.init(editorMode, fontFamily, initCallback, fontSize);
99
+ ZohoDeskEditor.create && ZohoDeskEditor.create(defaultObj);
100
+ }
101
+ }
102
+
103
+ plainTextSwitchCallback() {
104
+ let {
105
+ plainTextSwitchCallback,
106
+ id
107
+ } = this.props;
108
+ let content = this.handleGetContent();
109
+ plainTextSwitchCallback && plainTextSwitchCallback(content, id);
110
+ }
111
+
112
+ clearEditorData(id) {
113
+ let {
114
+ getRef
115
+ } = this.props;
116
+
117
+ if (global.editor && global.editor[id]) {
118
+ delete global.editor[id];
119
+ }
120
+
121
+ getRef && getRef(null);
122
+ }
123
+
124
+ componentWillReceiveProps(np) {
125
+ let {
126
+ changeEditorContent
127
+ } = this.props;
128
+ let id = np.id;
129
+ let editorObj = global.editor ? global.editor[id] ? global.editor[id] : {} : {};
130
+
131
+ if (np.isEmptyContent && editorObj) {
132
+ editorObj.setContent('');
133
+ }
134
+
135
+ if (typeof changeEditorContent !== 'undefined' && np.changeEditorContent != changeEditorContent && np.changeEditorContent) {
136
+ changeContent(id, np.value);
137
+ }
138
+ }
139
+
140
+ componentDidUpdate(prevProps, prevState) {
141
+ let {
142
+ id,
143
+ value,
144
+ shouldUpdateContent,
145
+ mode
146
+ } = this.props;
147
+ let {
148
+ isResourceLoaded
149
+ } = this.state;
150
+
151
+ if (prevProps.id !== id) {
152
+ global.editor[id] = global.editor[prevProps.id];
153
+ delete global.editor[prevProps.id];
154
+ shouldUpdateContent && changeContent(id, value);
155
+ }
156
+
157
+ if (prevState.isResourceLoaded !== isResourceLoaded && isResourceLoaded) {
158
+ this.initializeEditor(id, mode);
159
+ }
160
+ }
161
+
162
+ componentWillUnmount() {
163
+ this.mount = false;
164
+ this.clearEditorData(this.props.id);
165
+ window.removeEventListener('click', this.onWindowClick);
166
+ }
167
+
168
+ focusCallback() {
169
+ let {
170
+ onFocus
171
+ } = this.props;
172
+ onFocus && onFocus();
173
+ }
174
+
175
+ handleGetContent() {
176
+ let {
177
+ id
178
+ } = this.props;
179
+ let editorObj = global.editor[id] ? global.editor[id] : {};
180
+ let content = getRichEditorContent(id);
181
+
182
+ if (!editorContentValidate(editorObj)) {
183
+ content = '';
184
+ }
185
+
186
+ content = content.trim();
187
+ return content;
188
+ }
189
+
190
+ handleChange() {
191
+ let {
192
+ onChange,
193
+ id
194
+ } = this.props;
195
+
196
+ if (onChange) {
197
+ let content = this.handleGetContent();
198
+ onChange(content, id);
199
+ }
200
+ }
201
+
202
+ editorCallback(editorObj) {
203
+ let {
204
+ editorCallback,
205
+ getRef,
206
+ isCustomScroll
207
+ } = this.props;
208
+ this.setState({
209
+ isEditorLoad: true,
210
+ isEditorShow: true
211
+ });
212
+ let {
213
+ id
214
+ } = this.props;
215
+ global.editor = global.editor || {};
216
+
217
+ if (!global.editor[id]) {
218
+ global.editor[id] = editorObj;
219
+ }
220
+
221
+ const css = 'pre {white-space: pre-wrap}',
222
+ head = editorObj.doc.head || editorObj.doc.getElementsByTagName('head')[0],
223
+ style = document.createElement('style');
224
+ style.type = 'text/css';
225
+
226
+ if (style.styleSheet) {
227
+ style.styleSheet.cssText = css;
228
+ } else {
229
+ style.appendChild(editorObj.doc.createTextNode(css));
230
+ }
231
+
232
+ head.appendChild(style);
233
+ editorCallback && editorCallback(editorObj);
234
+ const iframe = selectn('iframe.contentDocument.body', editorObj) || null;
235
+ const iframeHead = selectn('iframe.contentDocument.head', editorObj) || null;
236
+ getRef && getRef(iframe);
237
+
238
+ if (iframe) {
239
+ iframe.addEventListener('click', () => editorObj.iframe.click());
240
+
241
+ if (isCustomScroll) {
242
+ let link = document.createElement('style');
243
+ link.innerText = "body{font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 0}.scroll{--zd-scroll-width:12px;--zd-scroll-height:12px;--zd-scroll-bg:rgba(255,255,255,0.1);--zd-scroll-corner-bg:transparent;--zd-scroll-thump:rgba(44,51,77,0.2);--zd-scroll-thump-hoverbg:rgba(44,51,77,0.3);--zd-scroll-border:rgba(44,51,77,0.1)}.scroll[data-scroll-palette='dark'],.scroll [data-scroll-palette='dark']{--zd-scroll-thump:rgba(255,255,255,0.2);--zd-scroll-thump-hoverbg:rgba(255,255,255,0.4);--zd-scroll-border:rgba(255,255,255,0.07)}.scroll,.scroll *{scrollbar-color:var(--zd-scroll-thump) var(--zd-scroll-bg);scrollbar-width:thin;-ms-scrollbar-highlight-color:var(--zd-scroll-bg);-ms-scrollbar-face-color:var(--zd-scroll-thump)}.scroll::-webkit-scrollbar,.scroll ::-webkit-scrollbar{background:var(--zd-scroll-corner-bg)}.scroll::-webkit-scrollbar:hover,.scroll ::-webkit-scrollbar:hover{background:var(--zd-scroll-bg)}.scroll::-webkit-scrollbar:horizontal,.scroll ::-webkit-scrollbar:horizontal{height:var(--zd-scroll-height)}.scroll::-webkit-scrollbar:vertical,.scroll ::-webkit-scrollbar:vertical{width:var(--zd-scroll-width)}.scroll::-webkit-scrollbar-button,.scroll ::-webkit-scrollbar-button{display:none;width:0;height:0}.scroll::-webkit-scrollbar-track:vertical,.scroll ::-webkit-scrollbar-track:vertical{border-left:1px solid transparent;border-right:1px solid transparent}.scroll::-webkit-scrollbar-track:vertical:hover,.scroll ::-webkit-scrollbar-track:vertical:hover{border-color:var(--zd-scroll-border)}.scroll::-webkit-scrollbar-track:horizontal,.scroll ::-webkit-scrollbar-track:horizontal{border-top:1px solid transparent;border-bottom:1px solid transparent}.scroll::-webkit-scrollbar-track:horizontal:hover,.scroll ::-webkit-scrollbar-track:horizontal:hover{border-color:var(--zd-scroll-border)}.scroll::-webkit-scrollbar-track-piece,.scroll ::-webkit-scrollbar-track-piece{background:inherit}.scroll::-webkit-scrollbar-thumb,.scroll ::-webkit-scrollbar-thumb{border-radius:10px;background:var(--zd-scroll-thump);background-clip:padding-box;border:3px solid transparent}.scroll::-webkit-scrollbar-thumb:hover,.scroll ::-webkit-scrollbar-thumb:hover{background:var(--zd-scroll-thump-hoverbg);background-clip:padding-box;border:3px solid transparent}.scroll::-webkit-scrollbar-corner,.scroll ::-webkit-scrollbar-corner{background:var(--zd-scroll-corner-bg)}.scroll::-webkit-resizer,.scroll::-webkit-resizer{background:inherit}";
244
+ iframeHead.appendChild(link);
245
+ iframe.classList.add('scroll');
246
+ }
247
+
248
+ let customFonts = document.createElement('style');
249
+ customFonts.innerText = `@font-face {font-family: 'ZohoPuviRegular';src: url('https://static.zohocdn.com/zohofonts/zohopuvi/4.0/Zoho_Puvi_Regular.woff2') format('woff2');font-style: normal;font-weight: normal;text-rendering: optimizeLegibility;font-display: swap}@font-face {font-family: Regular;src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');font-weight: 400;font-style: normal;font-display: swap}@font-face {font-family: 'RobotoRegular';font-weight: 400;font-style: normal;font-display: swa;src: url('https://static.zohocdn.com/webfonts/robotoregular/font.woff2')}`;
250
+ iframeHead.appendChild(customFonts);
251
+ }
252
+ }
253
+
254
+ handleInlineUpload(file, successCallback, failureCallback, mode, editorObj) {
255
+ let {
256
+ id,
257
+ setInlineAttachmentInProgress: progress,
258
+ i18nKeys
259
+ } = this.props;
260
+
261
+ if (!isFileNameSizeInvalid(file.name)) {
262
+ if (file.size != 0) {
263
+ if (file.size <= 3 * 1024 * 1024) {
264
+ if (isImageFormat(file.name)) {
265
+ progress && progress(true);
266
+ this.handleUpload(file).then(res => {
267
+ successCallback(res);
268
+ progress && progress(false);
269
+
270
+ if (id && editorObj) {
271
+ triggerKeyup(editorObj.doc);
272
+ }
273
+ }, () => {
274
+ failureCallback(i18nKeys.fileUploadError);
275
+ });
276
+ } else {
277
+ failureCallback(i18nKeys.fileNotSupported);
278
+ }
279
+ } else {
280
+ failureCallback(i18nKeys.fileSizeLimitExceed);
281
+ }
282
+ } else {
283
+ failureCallback(i18nKeys.fileEmptyError);
284
+ }
285
+ } else {
286
+ failureCallback(i18nKeys.fileNameLimitExceed);
287
+ }
288
+ }
289
+
290
+ handleDropUpload(file, successCallback, failureCallback) {
291
+ let e = {
292
+ target: {
293
+ files: [file]
294
+ }
295
+ };
296
+ let {
297
+ handleDropUpload
298
+ } = this.props;
299
+ handleDropUpload(e).then(res => {
300
+ successCallback(res);
301
+ }, () => {
302
+ failureCallback();
303
+ });
304
+ }
305
+
306
+ blurCallback() {
307
+ let {
308
+ blurCallback
309
+ } = this.props;
310
+ let content = this.handleGetContent();
311
+ blurCallback && blurCallback(content);
312
+ }
313
+
314
+ handleUpload(file) {
315
+ let {
316
+ onUpload,
317
+ editorMode,
318
+ getCSRFCookieName,
319
+ getCSRFCookie
320
+ } = this.props;
321
+
322
+ try {
323
+ let formData = new FormData();
324
+ formData.append('img_file', file, file.name);
325
+
326
+ if (getCSRFCookieName && getCSRFCookie) {
327
+ formData.append(getCSRFCookieName(), getCSRFCookie());
328
+ }
329
+
330
+ return onUpload(formData, file).then(res => {
331
+ if (editorMode === 'TicketReply') {
332
+ return `${res.data}&from=r`;
333
+ }
334
+
335
+ return res.data;
336
+ }, err => {
337
+ throw err;
338
+ });
339
+ } catch (err) {
340
+ return Promise.reject();
341
+ }
342
+ }
343
+
344
+ onWindowClick(e) {
345
+ let {
346
+ isEditorDefaultOpen
347
+ } = this.props;
348
+ let element = e.target;
349
+
350
+ if (!element.closest('[data-isEditor]') && !element.closest("[id='KB_Editor_UploadImage_Popup']") && !element.closest("[id='KB_Editor_Overlay']") && !element.closest('.zdeskEditor_popup') && element && typeof element.className === 'string' && !element.className.startsWith('KB') && !element.hasAttribute('data-insertoptions') && !element.closest('.KB_Editor_common_DropDown')) {
351
+ let {
352
+ value = '',
353
+ id
354
+ } = this.props;
355
+ let cont = value;
356
+
357
+ if (typeof editor !== 'undefined') {
358
+ // eslint-disable-next-line
359
+ cont = editor['addFormEditor'] && editor['addFormEditor'].getContent();
360
+ }
361
+
362
+ if (!isEditorDefaultOpen) {
363
+ if ((cont == '' || cont == '<div><br></div>') && this.mount) {
364
+ this.toggleEditor(false);
365
+ }
366
+ }
367
+ }
368
+ }
369
+
370
+ toggleEditor(value) {
371
+ let {
372
+ toggleEdit
373
+ } = this.props;
374
+ toggleEdit && toggleEdit(value);
375
+ }
376
+
377
+ render() {
378
+ let {
379
+ id,
380
+ dataId,
381
+ type,
382
+ border,
383
+ ImgLazyLoad,
384
+ loadingComponent,
385
+ isNightMode,
386
+ isReadOnly,
387
+ dataSelectorId
388
+ } = this.props;
389
+ let {
390
+ isEditorLoad,
391
+ isEditorShow
392
+ } = this.state;
393
+ let editorDoc = ImgLazyLoad && global.editor && global.editor[id] ? global.editor[id].doc : null;
394
+ return /*#__PURE__*/React.createElement(Container, {
395
+ className: `${styles.textEditor} ${styles[type]} ${styles[border]}
396
+ ${isNightMode ? styles.night : styles.light} ${isReadOnly ? styles.readOnly : ''} ${!isEditorShow ? styles.editorHide : ''}`,
397
+ dataId: dataId,
398
+ "data-isEditor": true,
399
+ dataSelectorId: dataSelectorId
400
+ }, loadingComponent && !isEditorLoad ? loadingComponent : null, /*#__PURE__*/React.createElement(Box, {
401
+ flexible: true,
402
+ id: id,
403
+ dataId: dataId
404
+ }), editorDoc && ImgLazyLoad ? /*#__PURE__*/React.createElement(ImgLazyLoad, {
405
+ node: editorDoc
406
+ }) : null, isReadOnly ? /*#__PURE__*/React.createElement("div", {
407
+ className: styles.readOnlyMask
408
+ }) : null);
409
+ }
410
+
411
+ }
412
+ TextEditor.defaultProps = defaultProps;
413
+ TextEditor.propTypes = propTypes; // if (__DOCS__) {
414
+ // TextEditor.docs = {
415
+ // componentGroup: 'Fields',
416
+ // folderName: 'TextEditor'
417
+ // };
418
+ // }