@zohodesk/components 1.0.0-alpha-242 → 1.0.0-alpha-245

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 (439) hide show
  1. package/README.md +1061 -1048
  2. package/assets/Appearance/dark/mode/darkMode.module.css +3 -18
  3. package/assets/Appearance/default/mode/defaultMode.module.css +2 -17
  4. package/assets/Appearance/pureDark/mode/pureDarkMode.module.css +5 -20
  5. package/docs/external/active-line.js +72 -72
  6. package/docs/external/autorefresh.js +47 -47
  7. package/docs/external/codemirror.js +9681 -9681
  8. package/docs/external/css/hopscotch.css +576 -576
  9. package/docs/external/css/styleGuide.css +1100 -1100
  10. package/docs/external/css.js +466 -466
  11. package/docs/external/designTokens.js +1 -1
  12. package/docs/external/foldcode.js +151 -151
  13. package/docs/external/format.js +129 -129
  14. package/docs/external/htmlmixed.js +84 -84
  15. package/docs/external/index.html +127 -127
  16. package/docs/external/javascript.js +422 -422
  17. package/docs/external/jsx.js +147 -147
  18. package/docs/external/matchbrackets.js +145 -145
  19. package/docs/external/xml.js +322 -322
  20. package/docs/package.json +41 -41
  21. package/docs/src/index.js +1311 -1311
  22. package/es/AppContainer/AppContainer.js +1 -1
  23. package/es/AppContainer/AppContainer.module.css +18 -18
  24. package/es/Avatar/Avatar.js +10 -10
  25. package/es/Avatar/Avatar.module.css +117 -117
  26. package/es/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
  27. package/es/AvatarTeam/AvatarTeam.js +8 -8
  28. package/es/AvatarTeam/AvatarTeam.module.css +161 -161
  29. package/es/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
  30. package/es/AvatarTeam/docs/AvatarTeam__custom.docs.js +0 -0
  31. package/es/AvatarTeam/docs/AvatarTeam__default.docs.js +0 -0
  32. package/es/AvatarTeam/docs/AvatarTeam__palette.docs.js +0 -0
  33. package/es/AvatarTeam/docs/AvatarTeam__size.docs.js +0 -0
  34. package/es/Button/Button.js +4 -4
  35. package/es/Button/Button.module.css +521 -521
  36. package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +191 -191
  37. package/es/Button/docs/Button__custom.docs.js +0 -0
  38. package/es/Button/docs/Button__default.docs.js +0 -0
  39. package/es/Buttongroup/Buttongroup.js +1 -1
  40. package/es/Buttongroup/Buttongroup.module.css +89 -89
  41. package/es/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
  42. package/es/Card/Card.js +4 -4
  43. package/es/Card/Card.module.css +20 -20
  44. package/es/Card/docs/Card__Custom.docs.js +0 -0
  45. package/es/Card/docs/Card__Default.docs.js +0 -0
  46. package/es/Card/docs/Card__Scroll.docs.js +0 -0
  47. package/es/CheckBox/CheckBox.js +1 -1
  48. package/es/CheckBox/CheckBox.module.css +153 -153
  49. package/es/CheckBox/docs/CheckBox__custom.docs.js +0 -0
  50. package/es/CheckBox/docs/CheckBox__default.docs.js +0 -0
  51. package/es/DateTime/CalendarView.js +0 -0
  52. package/es/DateTime/DateTime.js +4 -2
  53. package/es/DateTime/DateTime.module.css +187 -187
  54. package/es/DateTime/DateWidget.js +4 -2
  55. package/es/DateTime/DateWidget.module.css +38 -38
  56. package/es/DateTime/YearView.js +0 -0
  57. package/es/DateTime/YearView.module.css +81 -80
  58. package/es/DateTime/common.js +0 -0
  59. package/es/DateTime/docs/DateTime__default.docs.js +0 -0
  60. package/es/DateTime/docs/DateWidget__default.docs.js +0 -0
  61. package/es/DateTime/index.js +0 -0
  62. package/es/DateTime/objectUtils.js +0 -0
  63. package/es/DateTime/typeChecker.js +0 -0
  64. package/es/DateTime/validator.js +0 -0
  65. package/es/DropBox/DropBox.js +1 -1
  66. package/es/DropBox/DropBox.module.css +406 -406
  67. package/es/DropBox/DropBoxPositionMapping.json +144 -144
  68. package/es/DropDown/DropDown.js +0 -0
  69. package/es/DropDown/DropDown.module.css +5 -5
  70. package/es/DropDown/DropDownHeading.js +0 -0
  71. package/es/DropDown/DropDownHeading.module.css +53 -53
  72. package/es/DropDown/DropDownItem.js +0 -0
  73. package/es/DropDown/DropDownItem.module.css +94 -94
  74. package/es/DropDown/DropDownSearch.js +0 -0
  75. package/es/DropDown/DropDownSearch.module.css +14 -14
  76. package/es/DropDown/DropDownSeparator.js +0 -0
  77. package/es/DropDown/DropDownSeparator.module.css +7 -7
  78. package/es/Label/Label.js +2 -2
  79. package/es/Label/Label.module.css +52 -52
  80. package/es/Label/LabelColors.module.css +20 -20
  81. package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
  82. package/es/Label/docs/Label__clipped.docs.js +0 -0
  83. package/es/Label/docs/Label__custom.docs.js +0 -0
  84. package/es/Label/docs/Label__palette.docs.js +0 -0
  85. package/es/Label/docs/Label__size.docs.js +0 -0
  86. package/es/Label/docs/Label__type.docs.js +0 -0
  87. package/es/Layout/Box.js +0 -0
  88. package/es/Layout/Container.js +0 -0
  89. package/es/Layout/Layout.module.css +324 -324
  90. package/es/Layout/docs/Layout__default.docs.js +0 -0
  91. package/es/Layout/utils.js +0 -0
  92. package/es/LightNightMode/Colors.json +497 -398
  93. package/es/LightNightMode/docs/AlternativeColors.docs.js +21 -1
  94. package/es/ListItem/ListContainer.js +1 -1
  95. package/es/ListItem/ListItem.js +1 -1
  96. package/es/ListItem/ListItem.module.css +205 -205
  97. package/es/ListItem/ListItemWithAvatar.js +1 -1
  98. package/es/ListItem/ListItemWithCheckBox.js +1 -1
  99. package/es/ListItem/ListItemWithIcon.js +1 -1
  100. package/es/ListItem/ListItemWithRadio.js +1 -1
  101. package/es/Modal/Modal.js +1 -1
  102. package/es/MultiSelect/AdvancedGroupMultiSelect.js +19 -12
  103. package/es/MultiSelect/AdvancedMultiSelect.js +20 -8
  104. package/es/MultiSelect/MultiSelect.js +5 -5
  105. package/es/MultiSelect/MultiSelect.module.css +205 -197
  106. package/es/MultiSelect/MultiSelectWithAvatar.js +0 -0
  107. package/es/MultiSelect/SelectedOptions.js +1 -1
  108. package/es/MultiSelect/SelectedOptions.module.css +15 -15
  109. package/es/MultiSelect/Suggestions.js +1 -1
  110. package/es/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
  111. package/es/PopOver/PopOver.module.css +8 -8
  112. package/es/Popup/Popup.js +1 -1
  113. package/es/Popup/PositionMapping.json +73 -73
  114. package/es/Radio/Radio.js +0 -0
  115. package/es/Radio/Radio.module.css +110 -110
  116. package/es/Radio/docs/Radio__custom.docs.js +0 -0
  117. package/es/Radio/docs/Radio__default.docs.js +0 -0
  118. package/es/Responsive/CustomResponsive.js +0 -0
  119. package/es/Responsive/docs/Responsive__Custom.docs.js +0 -0
  120. package/es/Responsive/docs/style.module.css +55 -55
  121. package/es/ResponsiveDropBox/ResponsiveDropBox.js +1 -1
  122. package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
  123. package/es/Ribbon/Ribbon.js +0 -0
  124. package/es/Ribbon/Ribbon.module.css +376 -376
  125. package/es/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
  126. package/es/Ribbon/docs/Ribbon__custom.docs.js +0 -0
  127. package/es/Ribbon/docs/Ribbon__default.docs.js +0 -0
  128. package/es/RippleEffect/RippleEffect.module.css +70 -70
  129. package/es/Select/GroupSelect.js +0 -0
  130. package/es/Select/Select.js +1 -1
  131. package/es/Select/Select.module.css +106 -106
  132. package/es/Select/SelectWithAvatar.js +0 -0
  133. package/es/Select/SelectWithIcon.js +0 -0
  134. package/es/Select/__tests__/Select.spec.js +0 -0
  135. package/es/Select/docs/SelectWithIcon__default.docs.js +0 -0
  136. package/es/Select/docs/Select__default.docs.js +0 -0
  137. package/es/Stencils/Stencils.js +0 -0
  138. package/es/Stencils/Stencils.module.css +96 -96
  139. package/es/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
  140. package/es/Switch/Switch.js +1 -1
  141. package/es/Switch/Switch.module.css +109 -109
  142. package/es/Switch/docs/Switch__custom.docs.js +0 -0
  143. package/es/Switch/docs/Switch__default.docs.js +0 -0
  144. package/es/Tab/Tab.js +1 -1
  145. package/es/Tab/Tab.module.css +101 -101
  146. package/es/Tab/TabContent.module.css +4 -4
  147. package/es/Tab/TabWrapper.js +1 -1
  148. package/es/Tab/Tabs.js +18 -18
  149. package/es/Tab/Tabs.module.css +141 -141
  150. package/es/Tab/docs/tabdocs.module.css +29 -29
  151. package/es/Tag/Tag.js +8 -8
  152. package/es/Tag/Tag.module.css +254 -254
  153. package/es/Tag/docs/Tag__custom.docs.js +0 -0
  154. package/es/Tag/docs/Tag__default.docs.js +0 -0
  155. package/es/TextBox/TextBox.js +1 -1
  156. package/es/TextBox/TextBox.module.css +157 -157
  157. package/es/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
  158. package/es/TextBox/docs/TextBox__custom.docs.js +0 -0
  159. package/es/TextBox/docs/TextBox__default.docs.js +0 -0
  160. package/es/TextBox/docs/TextBox__variant.docs.js +0 -0
  161. package/es/TextBoxIcon/TextBoxIcon.js +1 -1
  162. package/es/TextBoxIcon/TextBoxIcon.module.css +78 -78
  163. package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
  164. package/es/TextBoxIcon/docs/TextBoxIcon__custom.docs.js +0 -0
  165. package/es/TextBoxIcon/docs/TextBoxIcon__default.docs.js +0 -0
  166. package/es/Textarea/Textarea.js +1 -1
  167. package/es/Textarea/Textarea.module.css +139 -139
  168. package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
  169. package/es/Textarea/docs/Textarea__custom.docs.js +0 -0
  170. package/es/Textarea/docs/Textarea__default.docs.js +0 -0
  171. package/es/Textarea/docs/Textarea__disabled.docs.js +0 -0
  172. package/es/Tooltip/Tooltip.module.css +109 -109
  173. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +1 -1
  174. package/es/beta/FocusRing/FocusRing.module.css +151 -151
  175. package/es/common/animation.module.css +624 -624
  176. package/es/common/avatarsizes.module.css +44 -44
  177. package/es/common/basic.module.css +33 -33
  178. package/es/common/basicReset.module.css +40 -40
  179. package/es/common/common.module.css +502 -502
  180. package/es/common/customscroll.module.css +89 -89
  181. package/es/common/docStyle.module.css +766 -766
  182. package/es/common/reset.module.css +12 -12
  183. package/es/common/transition.module.css +146 -146
  184. package/es/css.js +0 -1
  185. package/es/{MultiSelect → deprecated}/AdvancedMultiSelect.module.css +127 -127
  186. package/es/deprecated/advancedMultiSelectVariableJson.js +80 -0
  187. package/es/semantic/Button/semanticButton.module.css +9 -9
  188. package/es/utils/Common.js +0 -0
  189. package/es/utils/dropDownUtils.js +0 -0
  190. package/lib/Accordion/Accordion.js +2 -2
  191. package/lib/Accordion/AccordionItem.js +2 -2
  192. package/lib/Accordion/docs/Accordion__Demo.docs.js +2 -2
  193. package/lib/Animation/Animation.js +2 -2
  194. package/lib/Animation/docs/Animation__default.docs.js +2 -2
  195. package/lib/Animation/docs/Animation__fadeIn.docs.js +2 -2
  196. package/lib/Animation/docs/Animation__scaleIn.docs.js +2 -2
  197. package/lib/Animation/docs/Animation__skewIn.docs.js +2 -2
  198. package/lib/Animation/docs/Animation__slideDown.docs.js +2 -2
  199. package/lib/Animation/docs/Animation__slideLeft.docs.js +2 -2
  200. package/lib/Animation/docs/Animation__zoomIn.docs.js +2 -2
  201. package/lib/AppContainer/AppContainer.js +3 -3
  202. package/lib/AppContainer/AppContainer.module.css +18 -18
  203. package/lib/AppContainer/docs/AppContainer__default.docs.js +2 -2
  204. package/lib/Avatar/Avatar.js +12 -12
  205. package/lib/Avatar/Avatar.module.css +117 -117
  206. package/lib/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
  207. package/lib/Avatar/docs/Avatar__custom.docs.js +2 -2
  208. package/lib/Avatar/docs/Avatar__default.docs.js +2 -2
  209. package/lib/Avatar/docs/Avatar__palette.docs.js +2 -2
  210. package/lib/Avatar/docs/Avatar__text.docs.js +2 -2
  211. package/lib/AvatarTeam/AvatarTeam.js +10 -10
  212. package/lib/AvatarTeam/AvatarTeam.module.css +161 -161
  213. package/lib/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
  214. package/lib/AvatarTeam/docs/AvatarTeam__custom.docs.js +2 -2
  215. package/lib/AvatarTeam/docs/AvatarTeam__default.docs.js +2 -2
  216. package/lib/AvatarTeam/docs/AvatarTeam__palette.docs.js +2 -2
  217. package/lib/AvatarTeam/docs/AvatarTeam__size.docs.js +2 -2
  218. package/lib/Button/Button.js +6 -6
  219. package/lib/Button/Button.module.css +521 -521
  220. package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +191 -191
  221. package/lib/Button/docs/Button__custom.docs.js +2 -2
  222. package/lib/Button/docs/Button__default.docs.js +2 -2
  223. package/lib/Buttongroup/Buttongroup.js +3 -3
  224. package/lib/Buttongroup/Buttongroup.module.css +89 -89
  225. package/lib/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
  226. package/lib/Buttongroup/docs/Buttongroup__custom.docs.js +2 -2
  227. package/lib/Buttongroup/docs/Buttongroup__footer.docs.js +2 -2
  228. package/lib/Buttongroup/docs/Buttongroup__header.docs.js +2 -2
  229. package/lib/Card/Card.js +6 -6
  230. package/lib/Card/Card.module.css +20 -20
  231. package/lib/Card/docs/Card__Custom.docs.js +2 -2
  232. package/lib/Card/docs/Card__Default.docs.js +2 -2
  233. package/lib/Card/docs/Card__Scroll.docs.js +2 -2
  234. package/lib/CheckBox/CheckBox.js +3 -3
  235. package/lib/CheckBox/CheckBox.module.css +153 -153
  236. package/lib/CheckBox/docs/CheckBox__custom.docs.js +2 -2
  237. package/lib/CheckBox/docs/CheckBox__default.docs.js +2 -2
  238. package/lib/DateTime/CalendarView.js +2 -2
  239. package/lib/DateTime/DateTime.js +6 -4
  240. package/lib/DateTime/DateTime.module.css +187 -187
  241. package/lib/DateTime/DateTimePopupFooter.js +2 -2
  242. package/lib/DateTime/DateTimePopupHeader.js +2 -2
  243. package/lib/DateTime/DateWidget.js +6 -4
  244. package/lib/DateTime/DateWidget.module.css +38 -38
  245. package/lib/DateTime/DaysRow.js +2 -2
  246. package/lib/DateTime/Time.js +2 -2
  247. package/lib/DateTime/YearView.js +2 -2
  248. package/lib/DateTime/YearView.module.css +81 -80
  249. package/lib/DateTime/common.js +0 -0
  250. package/lib/DateTime/docs/DateTime__default.docs.js +2 -2
  251. package/lib/DateTime/docs/DateWidget__default.docs.js +2 -2
  252. package/lib/DateTime/index.js +0 -0
  253. package/lib/DateTime/objectUtils.js +0 -0
  254. package/lib/DateTime/typeChecker.js +0 -0
  255. package/lib/DateTime/validator.js +0 -0
  256. package/lib/DropBox/DropBox.js +3 -3
  257. package/lib/DropBox/DropBox.module.css +406 -406
  258. package/lib/DropBox/DropBoxPositionMapping.json +144 -144
  259. package/lib/DropBox/docs/DropBox__custom.docs.js +2 -2
  260. package/lib/DropBox/docs/DropBox__customOrder.docs.js +2 -2
  261. package/lib/DropBox/docs/DropBox__fixedPosition.docs.js +2 -2
  262. package/lib/DropBox/docs/DropBox__position.docs.js +2 -2
  263. package/lib/DropBox/docs/DropBox__size.docs.js +2 -2
  264. package/lib/DropDown/DropDown.js +2 -2
  265. package/lib/DropDown/DropDown.module.css +5 -5
  266. package/lib/DropDown/DropDownHeading.js +2 -2
  267. package/lib/DropDown/DropDownHeading.module.css +53 -53
  268. package/lib/DropDown/DropDownItem.js +2 -2
  269. package/lib/DropDown/DropDownItem.module.css +94 -94
  270. package/lib/DropDown/DropDownSearch.js +2 -2
  271. package/lib/DropDown/DropDownSearch.module.css +14 -14
  272. package/lib/DropDown/DropDownSeparator.js +2 -2
  273. package/lib/DropDown/DropDownSeparator.module.css +7 -7
  274. package/lib/DropDown/docs/DropDownHeading__custom.docs.js +2 -2
  275. package/lib/DropDown/docs/DropDownHeading__default.docs.js +2 -2
  276. package/lib/Label/Label.js +2 -2
  277. package/lib/Label/Label.module.css +52 -52
  278. package/lib/Label/LabelColors.module.css +20 -20
  279. package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
  280. package/lib/Label/docs/Label__clipped.docs.js +2 -2
  281. package/lib/Label/docs/Label__custom.docs.js +2 -2
  282. package/lib/Label/docs/Label__palette.docs.js +2 -2
  283. package/lib/Label/docs/Label__size.docs.js +2 -2
  284. package/lib/Label/docs/Label__type.docs.js +2 -2
  285. package/lib/Layout/Box.js +0 -0
  286. package/lib/Layout/Container.js +0 -0
  287. package/lib/Layout/Layout.module.css +324 -324
  288. package/lib/Layout/docs/Layout__Hidden.docs.js +2 -2
  289. package/lib/Layout/docs/Layout__default.docs.js +2 -2
  290. package/lib/Layout/docs/Layout__four_Column.docs.js +2 -2
  291. package/lib/Layout/docs/Layout__three_Column.docs.js +2 -2
  292. package/lib/Layout/docs/Layout__two_Column.docs.js +2 -2
  293. package/lib/Layout/utils.js +0 -0
  294. package/lib/LightNightMode/Colors.json +497 -398
  295. package/lib/LightNightMode/docs/AlternativeColors.docs.js +25 -3
  296. package/lib/ListItem/ListContainer.js +1 -1
  297. package/lib/ListItem/ListItem.js +3 -3
  298. package/lib/ListItem/ListItem.module.css +205 -205
  299. package/lib/ListItem/ListItemWithAvatar.js +3 -3
  300. package/lib/ListItem/ListItemWithCheckBox.js +3 -3
  301. package/lib/ListItem/ListItemWithIcon.js +3 -3
  302. package/lib/ListItem/ListItemWithRadio.js +3 -3
  303. package/lib/ListItem/docs/ListItemWithAvatar__custom.docs.js +2 -2
  304. package/lib/ListItem/docs/ListItemWithAvatar__default.docs.js +2 -2
  305. package/lib/ListItem/docs/ListItemWithCheckBox__custom.docs.js +2 -2
  306. package/lib/ListItem/docs/ListItemWithCheckBox__default.docs.js +2 -2
  307. package/lib/ListItem/docs/ListItemWithIcon__custom.docs.js +2 -2
  308. package/lib/ListItem/docs/ListItemWithIcon__default.docs.js +2 -2
  309. package/lib/ListItem/docs/ListItemWithRadio__custom.docs.js +2 -2
  310. package/lib/ListItem/docs/ListItemWithRadio__default.docs.js +2 -2
  311. package/lib/ListItem/docs/ListItem__custom.docs.js +2 -2
  312. package/lib/ListItem/docs/ListItem__default.docs.js +2 -2
  313. package/lib/Modal/Modal.js +3 -3
  314. package/lib/Modal/__docs__/Modal__default.docs.js +2 -2
  315. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +20 -14
  316. package/lib/MultiSelect/AdvancedMultiSelect.js +26 -15
  317. package/lib/MultiSelect/EmptyState.js +2 -2
  318. package/lib/MultiSelect/MultiSelect.js +7 -7
  319. package/lib/MultiSelect/MultiSelect.module.css +205 -197
  320. package/lib/MultiSelect/MultiSelectHeader.js +2 -2
  321. package/lib/MultiSelect/MultiSelectWithAvatar.js +2 -2
  322. package/lib/MultiSelect/SelectedOptions.js +3 -3
  323. package/lib/MultiSelect/SelectedOptions.module.css +15 -15
  324. package/lib/MultiSelect/Suggestions.js +3 -3
  325. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
  326. package/lib/MultiSelect/docs/AdvancedGroupMultiSelect__default.docs.js +2 -2
  327. package/lib/MultiSelect/docs/AdvancedMultiSelect__default.docs.js +2 -2
  328. package/lib/MultiSelect/docs/MultiSelectWithAvatar__default.docs.js +2 -2
  329. package/lib/MultiSelect/docs/MultiSelect__default.docs.js +2 -2
  330. package/lib/PopOver/PopOver.js +2 -2
  331. package/lib/PopOver/PopOver.module.css +8 -8
  332. package/lib/PopOver/docs/PopOver__default.docs.js +2 -2
  333. package/lib/Popup/Popup.js +3 -3
  334. package/lib/Popup/PositionMapping.json +73 -73
  335. package/lib/Popup/__tests__/Popup.spec.js +2 -2
  336. package/lib/Provider/docs/Provider_Id__Class.docs.js +2 -2
  337. package/lib/Provider/docs/Provider_Zindex__Class.docs.js +2 -2
  338. package/lib/Provider.js +2 -2
  339. package/lib/Radio/Radio.js +2 -2
  340. package/lib/Radio/Radio.module.css +110 -110
  341. package/lib/Radio/docs/Radio__custom.docs.js +2 -2
  342. package/lib/Radio/docs/Radio__default.docs.js +2 -2
  343. package/lib/Responsive/CustomResponsive.js +0 -0
  344. package/lib/Responsive/ResizeComponent.js +2 -2
  345. package/lib/Responsive/Responsive.js +2 -2
  346. package/lib/Responsive/docs/Responsive__Custom.docs.js +2 -2
  347. package/lib/Responsive/docs/Responsive__default.docs.js +2 -2
  348. package/lib/Responsive/docs/style.module.css +55 -55
  349. package/lib/Responsive/sizeObservers.js +3 -3
  350. package/lib/ResponsiveDropBox/ResponsiveDropBox.js +3 -3
  351. package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
  352. package/lib/Ribbon/Ribbon.js +2 -2
  353. package/lib/Ribbon/Ribbon.module.css +376 -376
  354. package/lib/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
  355. package/lib/Ribbon/docs/Ribbon__custom.docs.js +2 -2
  356. package/lib/Ribbon/docs/Ribbon__default.docs.js +2 -2
  357. package/lib/RippleEffect/RippleEffect.module.css +70 -70
  358. package/lib/RippleEffect/docs/RippleEffect__default.docs.js +2 -2
  359. package/lib/Select/GroupSelect.js +2 -2
  360. package/lib/Select/Select.js +3 -3
  361. package/lib/Select/Select.module.css +106 -106
  362. package/lib/Select/SelectWithAvatar.js +2 -2
  363. package/lib/Select/SelectWithIcon.js +2 -2
  364. package/lib/Select/__tests__/Select.spec.js +0 -0
  365. package/lib/Select/docs/GroupSelect__default.docs.js +2 -2
  366. package/lib/Select/docs/SelectWithAvatar__default.docs.js +2 -2
  367. package/lib/Select/docs/SelectWithIcon__default.docs.js +2 -2
  368. package/lib/Select/docs/Select__default.docs.js +2 -2
  369. package/lib/Stencils/Stencils.js +2 -2
  370. package/lib/Stencils/Stencils.module.css +96 -96
  371. package/lib/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
  372. package/lib/Stencils/docs/Stencils__custom.docs.js +2 -2
  373. package/lib/Stencils/docs/Stencils__default.docs.js +2 -2
  374. package/lib/Switch/Switch.js +3 -3
  375. package/lib/Switch/Switch.module.css +109 -109
  376. package/lib/Switch/docs/Switch__custom.docs.js +2 -2
  377. package/lib/Switch/docs/Switch__default.docs.js +2 -2
  378. package/lib/Tab/Tab.js +1 -1
  379. package/lib/Tab/Tab.module.css +101 -101
  380. package/lib/Tab/TabContent.module.css +4 -4
  381. package/lib/Tab/TabWrapper.js +1 -1
  382. package/lib/Tab/Tabs.js +14 -14
  383. package/lib/Tab/Tabs.module.css +141 -141
  384. package/lib/Tab/docs/Tab__default.docs.js +2 -2
  385. package/lib/Tab/docs/tabdocs.module.css +29 -29
  386. package/lib/Tag/Tag.js +10 -10
  387. package/lib/Tag/Tag.module.css +254 -254
  388. package/lib/Tag/docs/Tag__custom.docs.js +2 -2
  389. package/lib/Tag/docs/Tag__default.docs.js +2 -2
  390. package/lib/TextBox/TextBox.js +3 -3
  391. package/lib/TextBox/TextBox.module.css +157 -157
  392. package/lib/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
  393. package/lib/TextBox/docs/TextBox__custom.docs.js +2 -2
  394. package/lib/TextBox/docs/TextBox__default.docs.js +2 -2
  395. package/lib/TextBox/docs/TextBox__size.docs.js +2 -2
  396. package/lib/TextBox/docs/TextBox__variant.docs.js +2 -2
  397. package/lib/TextBoxIcon/TextBoxIcon.js +3 -3
  398. package/lib/TextBoxIcon/TextBoxIcon.module.css +78 -78
  399. package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
  400. package/lib/TextBoxIcon/docs/TextBoxIcon__custom.docs.js +2 -2
  401. package/lib/TextBoxIcon/docs/TextBoxIcon__default.docs.js +2 -2
  402. package/lib/Textarea/Textarea.js +3 -3
  403. package/lib/Textarea/Textarea.module.css +139 -139
  404. package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
  405. package/lib/Textarea/docs/Textarea__animated.docs.js +2 -2
  406. package/lib/Textarea/docs/Textarea__custom.docs.js +2 -2
  407. package/lib/Textarea/docs/Textarea__default.docs.js +2 -2
  408. package/lib/Textarea/docs/Textarea__disabled.docs.js +2 -2
  409. package/lib/Tooltip/Tooltip.js +2 -2
  410. package/lib/Tooltip/Tooltip.module.css +109 -109
  411. package/lib/Tooltip/__tests__/Tooltip.spec.js +2 -2
  412. package/lib/Tooltip/docs/Tooltip__default.docs.js +2 -2
  413. package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +2 -2
  414. package/lib/VelocityAnimation/VelocityAnimation/docs/VelocityAnimation__demo.docs.js +2 -2
  415. package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +3 -3
  416. package/lib/VelocityAnimation/VelocityAnimationGroup/docs/VelocityAnimationGroup__demo.docs.js +2 -2
  417. package/lib/a11y/FocusScope/docs/FocusScope__default.docs.js +2 -2
  418. package/lib/beta/FocusRing/FocusRing.module.css +151 -151
  419. package/lib/beta/FocusRing/docs/FocusRing__default.docs.js +2 -2
  420. package/lib/common/animation.module.css +624 -624
  421. package/lib/common/avatarsizes.module.css +44 -44
  422. package/lib/common/basic.module.css +33 -33
  423. package/lib/common/basicReset.module.css +40 -40
  424. package/lib/common/common.module.css +502 -502
  425. package/lib/common/customscroll.module.css +89 -89
  426. package/lib/common/docStyle.module.css +766 -766
  427. package/lib/common/reset.module.css +12 -12
  428. package/lib/common/transition.module.css +146 -146
  429. package/lib/css.js +0 -2
  430. package/lib/{MultiSelect → deprecated}/AdvancedMultiSelect.module.css +127 -127
  431. package/lib/deprecated/PortalLayer/PortalLayer.js +2 -2
  432. package/lib/deprecated/PortalLayer/docs/PortalLayer__default.docs.js +2 -2
  433. package/lib/deprecated/advancedMultiSelectVariableJson.js +82 -0
  434. package/lib/semantic/Button/Button.js +2 -2
  435. package/lib/semantic/Button/docs/Button__default.docs.js +2 -2
  436. package/lib/semantic/Button/semanticButton.module.css +9 -9
  437. package/lib/utils/Common.js +0 -0
  438. package/lib/utils/dropDownUtils.js +0 -0
  439. package/package.json +75 -75
package/docs/src/index.js CHANGED
@@ -1,1311 +1,1311 @@
1
- var Component = window.Component;
2
- var ReactDOM = Component.ReactDOM;
3
- var React = Component.React;
4
- import PropTypes from "prop-types";
5
-
6
- class App extends React.Component {
7
- constructor(props) {
8
- super(props);
9
- this.state = {
10
- selected:
11
- window.location.hash != ""
12
- ? window.location.hash.split("/")[0].split("#")[1]
13
- : "gettingStarted",
14
- theme: "theme1",
15
- selectedCom:
16
- window.location.hash != "" ? window.location.hash.split("/")[1] : "",
17
-
18
- selectedIconComponent:
19
- window.location.hash != "" ? window.location.hash.split("/")[1] : ""
20
- };
21
- this.selectTab = this.selectTab.bind(this);
22
- this.themeChoosing = this.themeChoosing.bind(this);
23
- this.selectComponent = this.selectComponent.bind(this);
24
- this.onSelectIconComponent = this.onSelectIconComponent.bind(this);
25
- this.setTooltipRef = this.setTooltipRef.bind(this);
26
- }
27
- selectComponent(comp, isScroll) {
28
- if (isScroll) {
29
- history.replaceState("", "", "#components/" + comp);
30
- } else {
31
- window.location.hash = "components/" + comp;
32
- }
33
- this.setState({ selectedCom: comp });
34
- }
35
- selectTab(tab) {
36
- window.location.hash = tab;
37
- this.setState({ selected: tab });
38
- }
39
-
40
- themeChoosing(theme) {
41
- this.selectTab("designTokens");
42
- this.setState({ theme: theme });
43
- }
44
-
45
- onSelectIconComponent(selectedIconComponent) {
46
- this.setState({ selectedIconComponent: selectedIconComponent });
47
- }
48
-
49
- setTooltipRef(ref) {
50
- this.tooltipRef = ref;
51
- }
52
- render() {
53
- let { selected, theme, selectedCom, selectedIconComponent } = this.state;
54
-
55
- let renderComp = {};
56
- Object.keys(Component).forEach(val => {
57
- let out =
58
- val.indexOf("__") != -1 ||
59
- val == "React" ||
60
- val == "ReactDOM" ||
61
- val == "renderToStaticMarkup"
62
- ? false
63
- : true;
64
- if (
65
- val.indexOf("__") != -1 &&
66
- Component[val.split("__")[0]].docs.external
67
- ) {
68
- if (renderComp[val.split("__")[0]] == undefined) {
69
- renderComp[val.split("__")[0]] = [];
70
- }
71
- renderComp[val.split("__")[0]].push(val);
72
- }
73
- });
74
-
75
- selectedCom = selectedCom ? selectedCom : Object.keys(renderComp)[0];
76
-
77
- let fonticonlist = [];
78
- Component &&
79
- Object.keys(Component).map(name => {
80
- if (name.indexOf("FontIcon__") != -1 && name != "FontIcon__All") {
81
- fonticonlist.push(name.split("__")[1]);
82
- }
83
- });
84
-
85
- selectedIconComponent = selectedIconComponent
86
- ? selectedIconComponent
87
- : fonticonlist[0];
88
- let renderCompIcon =
89
- Component[selectedIconComponent + "FontIcon__" + selectedIconComponent];
90
- let Tooltip = Component.Tooltip ? Component.Tooltip : null;
91
- return (
92
- <div onMouseOver={e => this.tooltipRef && this.tooltipRef.handleOver(e)}>
93
- <div>
94
- <div className="main dflexCol">
95
- {Component.Tooltip && (
96
- <Component.Tooltip ref={this.setTooltipRef} />
97
- )}
98
-
99
- <Header
100
- onSelect={this.selectTab}
101
- selected={selected}
102
- themeChoosing={this.themeChoosing}
103
- theme={theme}
104
- />
105
-
106
- {selected == "components" ? (
107
- <div className="container dflexRow flex1">
108
- <LeftPanel
109
- module="components"
110
- dummy={true}
111
- list={Object.keys(renderComp)}
112
- selectComponent={this.selectComponent}
113
- selectedCom={selectedCom}
114
- />
115
- <RightPanel
116
- module="components"
117
- selectedCom={selectedCom}
118
- renderComp={renderComp}
119
- selectComponent={this.selectComponent}
120
- />
121
- </div>
122
- ) : null}
123
-
124
- {selected == "gettingStarted" ? (
125
- <div className="container dflexRow flex1">
126
- <GettingStarted />
127
- </div>
128
- ) : null}
129
-
130
- {selected == "accessibility" ? (
131
- <div className="container dflexRow flex1">
132
- <Accessibility />
133
- </div>
134
- ) : null}
135
-
136
- {selected == "designTokens" ? (
137
- <div className="container dflexRow flex1">
138
- <DesignTokens theme={theme} />
139
- </div>
140
- ) : null}
141
-
142
- {selected == "utilities" ? (
143
- <div className="container dflexRow flex1">
144
- <Utilities theme={theme} />
145
- </div>
146
- ) : null}
147
-
148
- {selected == "icons" ? (
149
- <div className="container dflexRow flex1">
150
- <LeftPanel
151
- module="icons"
152
- list={fonticonlist}
153
- selectComponent={this.onSelectIconComponent}
154
- selectedCom={selectedIconComponent}
155
- />
156
-
157
- <IconComponentRender
158
- component={renderCompIcon}
159
- heading={selectedIconComponent}
160
- />
161
- </div>
162
- ) : null}
163
-
164
- {selected == "faq" ? (
165
- <div className="container dflexRow flex1">
166
- <div className="faqs">FAQS Coming soon..</div>
167
- </div>
168
- ) : null}
169
- </div>
170
- </div>
171
- </div>
172
- );
173
- }
174
- }
175
-
176
- class IconComponentRender extends React.Component {
177
- constructor(props) {
178
- super(props);
179
- }
180
-
181
- render() {
182
- let { component, heading } = this.props;
183
- let RenderComponent = component ? component : null;
184
- return (
185
- <div className="rightPanel flex1">
186
- <div className="iconCont">
187
- <h1 className="compName">
188
- {heading.replace(/([A-Z])/g, " $1").trim()}
189
- </h1>
190
- <div className="codeHint">
191
- <div>
192
- {" "}
193
- {"import " +
194
- heading +
195
- "FontIcon from @zohodesk/components/lib/FontIcon/" +
196
- heading +
197
- "FontIcon"}{" "}
198
- </div>
199
- <div>
200
- {" "}
201
- {"<" + heading + 'FontIcon name="iconName" size="small"/> '}{" "}
202
- </div>
203
- </div>
204
- <div className="wicon">
205
- {RenderComponent ? (
206
- <RenderComponent CopyComp={CopyTextComp} />
207
- ) : null}
208
- </div>{" "}
209
- </div>
210
- </div>
211
- );
212
- }
213
- }
214
-
215
- class Header extends React.Component {
216
- constructor(props) {
217
- super(props);
218
- this.state = {
219
- popup: false,
220
- toggleMenuTop: false,
221
- rtlView: false
222
- };
223
- this.popupToggle = this.popupToggle.bind(this);
224
- this.popupHide = this.popupHide.bind(this);
225
- this.toggleMenu = this.toggleMenu.bind(this);
226
- this.removeClose = this.removeClose.bind(this);
227
- }
228
- componentWillMount() {
229
- document.addEventListener("click", this.popupHide);
230
- }
231
- componentWillUnmount() {
232
- document.removeEventListener("click", this.popupHide);
233
- }
234
- popupToggle(e) {
235
- this.setState({ popup: !this.state.popup });
236
- this.removeClose(e);
237
- }
238
- popupHide() {
239
- this.setState({ popup: false });
240
- this.setState({ toggleMenuTop: false });
241
- }
242
- removeClose(e) {
243
- e.stopPropagation && e.stopPropagation();
244
- e.nativeEvent.stopImmediatePropagation &&
245
- e.nativeEvent.stopImmediatePropagation();
246
- }
247
- toggleMenu() {
248
- this.setState({ toggleMenuTop: !this.state.toggleMenuTop });
249
- }
250
- onClickRtl() {
251
- this.setState({ rtlView: !this.state.rtlView });
252
- if (!this.state.rtlView) {
253
- document.querySelector("html").setAttribute("dir", "rtl");
254
- } else {
255
- document.querySelector("html").setAttribute("dir", "ltr");
256
- }
257
- }
258
- render() {
259
- let { onSelect, selected, themeChoosing, theme } = this.props;
260
- let { popup, toggleMenuTop, rtlView } = this.state;
261
- return (
262
- <div className="header dflex">
263
- <div className="headerLeftimg" />
264
- <div className="hdrTabs">
265
- <button
266
- tabIndex="1"
267
- className={selected == "gettingStarted" ? "activeTab" : ""}
268
- onClick={onSelect.bind(this, "gettingStarted")}
269
- >
270
- Getting Started
271
- </button>
272
- <button
273
- tabIndex="3"
274
- className={selected == "designTokens" ? "activeTab" : ""}
275
- onClick={onSelect.bind(this, "designTokens")}
276
- >
277
- Design Tokens
278
- </button>
279
-
280
- <button
281
- tabIndex="4"
282
- className={selected == "components" ? "activeTab" : ""}
283
- onClick={onSelect.bind(this, "components")}
284
- >
285
- Components
286
- </button>
287
- <button
288
- tabIndex="6"
289
- className={selected == "icons" ? "activeTab" : ""}
290
- onClick={onSelect.bind(this, "icons")}
291
- >
292
- Icons
293
- </button>
294
- </div>
295
- <svg
296
- className={rtlView ? "rtlIcnActv rtlIcn" : "rtlIcn"}
297
- onClick={this.onClickRtl.bind(this, "rtl")}
298
- >
299
- <use xlinkHref="#icon-rtl" />
300
- </svg>
301
- </div>
302
- );
303
- }
304
- }
305
-
306
- class GettingStarted extends React.Component {
307
- constructor(props) {
308
- super(props);
309
- }
310
-
311
- render() {
312
- return (
313
- <div className="getting">
314
- <div>
315
- <div className="centerIcon">
316
- <svg className="deskIcon">
317
- <use xlinkHref="#icon-desk" />
318
- </svg>
319
- </div>
320
- <div className="gettingHd">Zoho Desk Style Guide</div>
321
- <div className="gtngDescrpt">
322
- {
323
- "You can use any Frontend framework to design your app. We have provided UI library to get ZohoDesk's UI in your app. Since you are using our UI library you can feel the ZohoDesk's UI experience in your app. We were using the components from our library to develop our product. So we hope you are happy with these components library. To get the UI similar to ZohoDesk we are providing CSS and React components and you can use that to develop your app."
324
- }
325
- </div>
326
- <div className="mainObjSec">
327
- <div>
328
- The Main Objective of Zoho Desk help Component will be Provide{" "}
329
- </div>
330
- <ul>
331
- <li>Semantic and Accessible component markup</li>
332
- <li>Cross browser compatible CSS</li>
333
- <li>Icons & Fonts</li>
334
- </ul>
335
- </div>
336
- <div className="package">
337
- We are exposing our components library based on{" "}
338
- <span className="cssURLtext">
339
- CDN URL
340
- <div className="cdnUrl">
341
- <span>
342
- https://localjs.zohostatic.com/support/zohodeskcomponent@0.0.0-alpha-0/dist/styles.css
343
- </span>
344
- <span id="cssURL" className="copyTxtHiden">
345
- https://localjs.zohostatic.com/support/zohodeskcomponent@0.0.0-alpha-0/dist/styles.css
346
- </span>
347
- <svg
348
- className="cpyIcnCmn cpyCdn"
349
- onClick={selectText.bind(this, "cssURL")}
350
- >
351
- <use xlinkHref="#icon-copy" />
352
- </svg>
353
- </div>
354
- </span>{" "}
355
- and{" "}
356
- <span>
357
- <span>
358
- NPM Package( npm install @zohodesk/components
359
- <span id="npminstall" className="copyTxtHiden">
360
- npm install @zohodesk/components
361
- </span>
362
- <svg
363
- className="cpyNpm"
364
- onClick={selectText.bind(this, "npminstall")}
365
- >
366
- <use xlinkHref="#icon-copy" />
367
- </svg>{" "}
368
- )
369
- </span>
370
- </span>
371
- </div>
372
- </div>
373
- </div>
374
- );
375
- }
376
- }
377
-
378
- class Accessibility extends React.Component {
379
- constructor(props) {
380
- super(props);
381
- }
382
-
383
- render() {
384
- return (
385
- <div className="accessBG">
386
- <div className="accessibility">
387
- <div className="accessR">
388
- <div className="accessHead">Overview</div>
389
- <div className="accessCon">
390
- To address the people with disabilities,We are compliance with
391
- accessible Rich Indent applicatiopns (ARIA)
392
- </div>
393
- </div>
394
-
395
- <div className="accessR">
396
- <div className="accessHead">KeyBoard Navigations</div>
397
- <div className="accessCon">
398
- While we do not provide the JavaScript that is necessary to make
399
- our components interactive, in the Accessibility Patterns, we
400
- provide working examples of basic patterns with documentation on
401
- what interactions are required. There is also advice in the
402
- individual component’s documentation on how to create
403
- keyboard-accessible components.
404
- </div>
405
- </div>
406
-
407
- <div className="accessR">
408
- <div className="accessHead">Accessible Forms</div>
409
- <div className="accessCon">
410
- Our forms offer proper use of "fieldset" and "legend" tags as well
411
- as appropriate labeling for input controls. Our radio button and
412
- checkbox controls provide a balanced solution that offers
413
- accessibility as well as design flexibility.
414
- </div>
415
- </div>
416
-
417
- <div className="accessR">
418
- <div className="accessHead">Appropriate use of color</div>
419
- <div className="accessCon">
420
- Our components follow the two main rules of accessibility as it
421
- relates to color:
422
- <p>
423
- We never use color as the only means of providing information or
424
- requesting an action.
425
- </p>
426
- <p>
427
- The combinations of text and their background colors do not fall
428
- below the WCAG recommended threshold ratio of 4.5:1 for
429
- standard.
430
- </p>
431
- </div>
432
- </div>
433
- </div>
434
- </div>
435
- );
436
- }
437
- }
438
-
439
- class DesignTokens extends React.Component {
440
- constructor(props) {
441
- super(props);
442
- this.state = {
443
- selectedCom:
444
- window.location.hash != "" ? window.location.hash.split("/")[1] : ""
445
- };
446
- this.selectComponent = this.selectComponent.bind(this);
447
- }
448
- selectComponent(comp) {
449
- window.location.hash = "designTokens/" + comp;
450
- this.setState({ selectedCom: comp });
451
- }
452
- render() {
453
- let { theme } = this.props;
454
- let { selectedCom } = this.state;
455
- let menuList = ["Background Color", "Text Color", "Border Color", "Shadow"];
456
-
457
- // 'Opacity',
458
- // 'Line Height',
459
- // 'Spacing',
460
- // 'Radius',
461
- // 'Sizing',
462
- // 'Time',
463
- // 'Media Query',
464
- // 'Z-Index'
465
- //'Font',
466
- //'Font Size'
467
-
468
- selectedCom = selectedCom ? selectedCom : menuList[0];
469
-
470
- selectedCom = decodeURI(selectedCom);
471
- return (
472
- <React.Fragment>
473
- <LeftPanel
474
- module="designTokens"
475
- list={menuList}
476
- selectedCom={selectedCom}
477
- selectComponent={this.selectComponent}
478
- />
479
- <DesignTokenView theme={theme} selectedCom={selectedCom} />
480
- </React.Fragment>
481
- );
482
- }
483
- }
484
-
485
- class Search extends React.Component {
486
- constructor(props) {
487
- super(props);
488
- this.state = {
489
- input: false
490
- };
491
- this.focusInput = this.focusInput.bind(this);
492
- this.blurInput = this.blurInput.bind(this);
493
- }
494
- focusInput() {
495
- this.setState({ input: true });
496
- }
497
- blurInput() {
498
- this.setState({ input: false });
499
- }
500
-
501
- render() {
502
- let { theme } = this.props;
503
- let { input } = this.state;
504
- return (
505
- <div className={input ? "inputBox inputBoxFocus" : "inputBox"}>
506
- <svg
507
- className={input ? "icon icon-search inSearch" : "icon icon-search"}
508
- >
509
- <use xlinkHref="#icon-search" />
510
- </svg>
511
- <input type="text" onFocus={this.focusInput} onBlur={this.blurInput} />
512
- </div>
513
- );
514
- }
515
- }
516
-
517
- class CopyTextComp extends React.Component {
518
- constructor(props) {
519
- super(props);
520
- this.state = {
521
- isCopied: false
522
- };
523
- this.onCopy = this.onCopy.bind(this);
524
- this.onCopied = this.onCopied.bind(this);
525
- }
526
- onCopy(copyTxt) {
527
- this.setState({
528
- isCopied: true
529
- });
530
- selectText(copyTxt);
531
- }
532
-
533
- onCopied() {
534
- let element = this.element;
535
- this.setState({
536
- isCopied: false
537
- });
538
- element.removeEventListener("webkitAnimationEnd", this.onCopied);
539
- element.removeEventListener("animationend", this.onCopied);
540
- }
541
-
542
- componentDidUpdate() {
543
- let element = this.element;
544
- element && element.addEventListener("webkitAnimationEnd", this.onCopied);
545
- element && element.addEventListener("animationend", this.onCopied);
546
- }
547
-
548
- render() {
549
- let { isCopy, copyTxt } = this.props;
550
- let { isCopied } = this.state;
551
- return (
552
- <div
553
- className={isCopied ? "copyDv isCopied" : "copyDv"}
554
- onClick={this.onCopy.bind(this, copyTxt)}
555
- >
556
- <div id={copyTxt} className="copyTxtHiden">
557
- {copyTxt}
558
- </div>
559
- <div className="cpyBtn">Copy</div>
560
- {isCopied && (
561
- <div
562
- ref={ele => {
563
- this.element = ele;
564
- }}
565
- className="copiedTxt"
566
- >
567
- Copied!
568
- </div>
569
- )}
570
- </div>
571
- );
572
- }
573
- }
574
- CopyTextComp.propTypes = {
575
- isCopy: PropTypes.bool,
576
- copyTxt: PropTypes.string
577
- };
578
-
579
- class DesignTokenView extends React.Component {
580
- constructor(props) {
581
- super(props);
582
- this.setTooltipRef = this.setTooltipRef.bind(this);
583
- }
584
- componentDidMount() {
585
- let fontsizecom = Component["FontSize"];
586
- fontsizecom &&
587
- ReactDOM.render(
588
- React.createElement(fontsizecom),
589
- document.getElementById("fontsize")
590
- );
591
- }
592
-
593
- setTooltipRef(ref) {
594
- this.tooltipRef = ref;
595
- }
596
-
597
- render() {
598
- let { theme, module, selectedCom } = this.props;
599
- var backgroundColor = designTokens[theme]["backgroundColor"] || {};
600
- var textColor = designTokens[theme]["textColor"] || {};
601
- var borderColor = designTokens[theme]["borderColor"] || {};
602
- var shadowColor = designTokens[theme]["shadowColor"] || {};
603
- let Tooltip = Component.Tooltip ? Component.Tooltip : null;
604
-
605
- return (
606
- <div
607
- className="rightPanel flex1"
608
- onMouseOver={e => this.tooltipRef && this.tooltipRef.handleOver(e)}
609
- >
610
- <Tooltip ref={this.setTooltipRef} />
611
-
612
- <div className="designTokenDet">
613
- {selectedCom == "Background Color" ? (
614
- <React.Fragment>
615
- {
616
- // <h2 className="compName" id="designTokens/Background Color">
617
- // Background Colors
618
- // </h2>
619
- }
620
- <div className="renderContent">
621
- Use these CSS variables for Background colors.
622
- </div>
623
- {Object.keys(backgroundColor).map((color, i) => {
624
- return (
625
- <div key={i} className="colorShow clipBoard">
626
- <div
627
- style={{ background: backgroundColor[color] }}
628
- className="colorDv"
629
- />
630
- <div className="colorName">
631
- <div data-title={color}> {color} </div>
632
- <div data-title={backgroundColor[color]}>
633
- {" "}
634
- {backgroundColor[color]}{" "}
635
- </div>
636
- </div>
637
- <CopyTextComp copyTxt={`var(${color})`} />
638
- </div>
639
- );
640
- })}
641
- </React.Fragment>
642
- ) : null}
643
-
644
- {selectedCom == "Text Color" ? (
645
- <React.Fragment>
646
- {
647
- // <h2 className="compName" id="designTokens/Text Color">
648
- // Text Colors
649
- // </h2>
650
- }
651
- <div className="renderContent">
652
- <p>Use these CSS variables for Text colors.</p>
653
- </div>
654
- {Object.keys(textColor).map((color, i) => {
655
- return (
656
- <div key={i} className="colorShow clipBoard">
657
- <div id={color} className="copyTxtHiden">
658
- {" "}
659
- {color}
660
- </div>
661
- <div
662
- style={{ background: textColor[color] }}
663
- className="colorDv"
664
- />
665
- <div className="colorName">
666
- <div data-title={color}> {color} </div>
667
- <div data-title={textColor[color]}>
668
- {" "}
669
- {textColor[color]}{" "}
670
- </div>
671
- </div>
672
- <CopyTextComp copyTxt={`color:var(${color})`} />
673
- </div>
674
- );
675
- })}
676
- </React.Fragment>
677
- ) : null}
678
-
679
- {selectedCom == "Border Color" ? (
680
- <React.Fragment>
681
- {
682
- // <h2 className="compName" id="designTokens/Border Color">
683
- // Border Colors
684
- // </h2>
685
- }
686
- <div className="renderContent">
687
- <p>Use these CSS variables for Border colors.</p>
688
- </div>
689
- {Object.keys(borderColor).map((color, i) => {
690
- return (
691
- <div key={i} className="colorShow clipBoard">
692
- <div id={color} className="copyTxtHiden">
693
- {" "}
694
- {color}
695
- </div>
696
- <div
697
- style={{ background: borderColor[color] }}
698
- className="colorDv"
699
- />
700
- <div className="colorName">
701
- <div data-title={color}> {color} </div>
702
- <div data-title={borderColor[color]}>
703
- {" "}
704
- {borderColor[color]}{" "}
705
- </div>
706
- </div>
707
- <CopyTextComp copyTxt={`var(${color})`} />
708
- </div>
709
- );
710
- })}
711
- </React.Fragment>
712
- ) : null}
713
-
714
- {selectedCom == "Shadow" ? (
715
- <React.Fragment>
716
- {
717
- // <h2 className="compName" id="designTokens/Shadow">
718
- // Shadow Colors
719
- // </h2>
720
- }
721
- <div className="renderContent">
722
- <p>Use these CSS variables for Shadow colors.</p>
723
- </div>
724
- {Object.keys(shadowColor).map((color, i) => {
725
- return (
726
- <div key={i} className="colorShow clipBoard">
727
- <div id={color} className="copyTxtHiden">
728
- {" "}
729
- {color}
730
- </div>
731
- <div
732
- style={{ background: shadowColor[color] }}
733
- className="colorDv"
734
- />
735
- <div className="colorName">
736
- <div data-title={color}> {color} </div>
737
- <div data-title={shadowColor[color]}>
738
- {" "}
739
- {shadowColor[color]}{" "}
740
- </div>
741
- </div>
742
- <CopyTextComp copyTxt={`var(${color})`} />
743
- </div>
744
- );
745
- })}
746
- </React.Fragment>
747
- ) : null}
748
-
749
- {selectedCom == "Font Size" ? (
750
- <div>
751
- <h2 className="compName" id="designTokens/Font Size">
752
- Font Size
753
- </h2>
754
- <div className="renderContent">
755
- <p>Use these tokens for Font Size only.</p>
756
- </div>
757
- <div className="bgColors">
758
- <div id="fontsize" />
759
- </div>
760
- </div>
761
- ) : null}
762
- </div>
763
- </div>
764
- );
765
- }
766
- }
767
-
768
- class Utilities extends React.Component {
769
- constructor(props) {
770
- super(props);
771
- this.state = {
772
- selectedCom:
773
- window.location.hash != "" ? window.location.hash.split("/")[1] : ""
774
- };
775
- this.selectComponent = this.selectComponent.bind(this);
776
- }
777
- selectComponent(comp) {
778
- window.location.hash = "utilities/" + comp;
779
- this.setState({ selectedCom: comp });
780
- }
781
-
782
- render() {
783
- let { list } = this.props;
784
- let { selectedCom } = this.state;
785
- var utilitiesList = [
786
- "Alignment",
787
- "Borders",
788
- "Box",
789
- "Margin",
790
- "Padding",
791
- "Floats",
792
- "Grid",
793
- "Horizontal List",
794
- "Interactions",
795
- "Layout",
796
- "Position"
797
- ];
798
- return (
799
- <LeftPanel
800
- module="utilities"
801
- selectedCom={selectedCom}
802
- list={utilitiesList}
803
- selectComponent={this.selectComponent}
804
- />
805
- );
806
- }
807
- }
808
-
809
- class LeftPanel extends React.Component {
810
- constructor(props) {
811
- super(props);
812
- this.state = {
813
- toggleLeft: false
814
- };
815
- this.toggleLeftBar = this.toggleLeftBar.bind(this);
816
- this.mobLeftHide = this.mobLeftHide.bind(this);
817
- }
818
- toggleLeftBar() {
819
- this.setState({ toggleLeft: !this.state.toggleLeft });
820
- }
821
- mobLeftHide(name) {
822
- this.setState({ toggleLeft: false });
823
- this.props.selectComponent(name);
824
- }
825
- componentDidUpdate() {
826
- let ele = this.leftPanel.getElementsByClassName("compAct")[0];
827
-
828
- if (ele) {
829
- let top = ele.getBoundingClientRect().top;
830
- if (top < 56) {
831
- this.leftPanel.scrollTop = ele.offsetTop - this.leftPanel.offsetTop;
832
- } else if (top > window.innerHeight - 100) {
833
- this.leftPanel.scrollTop = ele.offsetTop + window.innerHeight - 100;
834
- }
835
- }
836
- }
837
- render() {
838
- let { list, selectComponent, selectedCom, dummy, module } = this.props;
839
- let { toggleLeft } = this.state;
840
-
841
- return (
842
- <div
843
- className={toggleLeft ? "leftPanel leftPanelShow" : "leftPanel"}
844
- ref={leftPanel => {
845
- this.leftPanel = leftPanel;
846
- }}
847
- >
848
- {list.map((name, i) => {
849
- return (
850
- <a
851
- className={selectedCom == name ? "compAct" : "comp"}
852
- key={i}
853
- href={"#" + module + "/" + name}
854
- onClick={this.mobLeftHide.bind(this, name)}
855
- >
856
- {name}
857
- </a>
858
- );
859
- })}
860
- </div>
861
- );
862
- }
863
- }
864
-
865
- class RightPanel extends React.Component {
866
- constructor(props) {
867
- super(props);
868
- // this.htmlCode = this.htmlCode.bind(this);
869
- this.stopEvent = this.stopEvent.bind(this);
870
- this.scrollCom = this.scrollCom.bind(this);
871
- }
872
-
873
- stopEvent(e) {
874
- e.preventDefault();
875
- }
876
-
877
- // htmlCode(name) {
878
- // var code = Component.renderToStaticMarkup(
879
- // React.createElement(Component[name])
880
- // );
881
-
882
- // document.getElementById('html' + name).value = global.process(code);
883
-
884
- // if (
885
- // typeof CodeMirror !== 'undefined' &&
886
- // document.getElementById('html' + name)
887
- // ) {
888
- // CodeMirror.fromTextArea(document.getElementById('html' + name), {
889
- // lineNumbers: false,
890
- // styleActiveLine: false,
891
- // matchBrackets: false,
892
- // theme: 'blackboard',
893
- // readOnly: true
894
- // });
895
- // }
896
-
897
- // let stopAHref = document.querySelectorAll('.renderCom a');
898
- // stopAHref.forEach(ele => {
899
- // ele.addEventListener('click', this.stopEvent);
900
- // });
901
- // }
902
-
903
- scrollCom(e) {
904
- let child = e.target.childNodes || {};
905
- let { selectedCom, selectComponent } = this.props;
906
-
907
- Object.keys(child).forEach(val => {
908
- if (
909
- child[val].getBoundingClientRect().top < 54 &&
910
- child[val].getBoundingClientRect().top > 0
911
- ) {
912
- let comp = child[val].getAttribute("id").split("/")[1];
913
- selectedCom !== comp ? selectComponent(comp, true) : null;
914
- }
915
- });
916
- }
917
-
918
- render() {
919
- let { selectedCom, renderComp, module } = this.props;
920
- return (
921
- <div className="rightPanel flex1">
922
- {Object.keys(renderComp).map((comName, i) => {
923
- let description =
924
- Component[comName].docs && Component[comName].docs.description
925
- ? Component[comName].docs.description
926
- : "No description for " + comName;
927
-
928
- let rendering = false;
929
- renderComp[comName].forEach((sub, k) => {
930
- let a = sub.split("__")[0];
931
- rendering = a == selectedCom ? true : false;
932
- });
933
-
934
- if (rendering) {
935
- let propsObj =
936
- (Component &&
937
- Component[selectedCom] &&
938
- // eslint-disable-next-line react/forbid-foreign-prop-types
939
- Component[selectedCom].propTypes) ||
940
- {};
941
- let propsObjDesc =
942
- (Component &&
943
- Component[selectedCom] &&
944
- Component[selectedCom].propTypesDescription) ||
945
- {};
946
- let currentCompProps = Object.keys(propsObjDesc) || [];
947
- let currentCompDefault =
948
- (Component[selectedCom] && Component[selectedCom].defaultProps) ||
949
- {};
950
-
951
- let additinonalDesc =
952
- (Component[selectedCom].docs.additionalDescription &&
953
- Component[selectedCom].docs.additionalDescription) ||
954
- null;
955
-
956
- return (
957
- <div key={i} className="renderCom" id={module + "/" + comName}>
958
- <h1 className="compName">{comName}</h1>
959
- <p className="compDesc">{description}</p>
960
-
961
- <div dangerouslySetInnerHTML={{ __html: additinonalDesc }} />
962
-
963
- {
964
- // {PlayGround ? (
965
- // <div className="playGround">
966
- // <PlayGround propsObj={propsObj} RenderCode={Component[comName] } currentCompDefault={currentCompDefault}/>
967
- // </div>
968
- // ) : null}
969
- }
970
- {
971
- // let PlayGround =
972
- // renderComp[comName].indexOf(comName + '__PlayGround') == -1
973
- // ? null
974
- // : Component[comName + '__PlayGround'];
975
- }
976
-
977
- {renderComp[comName].map((states, j) => {
978
- let srcReact =
979
- Component[states].docs && Component[states].docs.source
980
- ? Component[states].docs.source
981
- : "no Code";
982
- let descr =
983
- Component[states].docs && Component[states].docs.description
984
- ? Component[states].docs.description
985
- : "No description for " + states.split("__")[1];
986
-
987
- if (states.split("__")[1] != "PlayGround") {
988
- return (
989
- <StateComponent
990
- key={j}
991
- states={states}
992
- descr={descr}
993
- srcReact={srcReact}
994
- renCode={Component[states]}
995
- />
996
- );
997
- } else {
998
- return null;
999
- }
1000
- })}
1001
- {Object.keys(currentCompProps).length ? (
1002
- <div>
1003
- <div className="proprti">Properties</div>
1004
- <div className="propTable">
1005
- <div className="tableHeader dflexRow">
1006
- <span className="brR">PropsName</span>
1007
- <span className="brR">Type</span>
1008
- <span className="brR">isRequired</span>
1009
- <span className="brR bn">Default Props</span>
1010
- <span className="brR bn">Description</span>
1011
- </div>
1012
-
1013
- {currentCompProps.length &&
1014
- currentCompProps.map((value, i) => {
1015
- let hookArray = [];
1016
- if (
1017
- propsObj[value] &&
1018
- propsObj[value].hookType &&
1019
- (propsObj[value].hookType.indexOf("enum") != -1 ||
1020
- propsObj[value].hookType.indexOf("union") != -1)
1021
- ) {
1022
- let uni = "";
1023
- if (
1024
- propsObj[value].hookType.indexOf("union") != -1
1025
- ) {
1026
- let val = propsObj[value].hookType;
1027
- let a = val.replace("union", "");
1028
- a = a.replace("]", "");
1029
- a = a.replace("[", "");
1030
- uni = a.split(",");
1031
- }
1032
-
1033
- hookArray =
1034
- propsObj[value].hookType.indexOf("enum") != -1
1035
- ? JSON.parse(
1036
- propsObj[value].hookType.replace("enum", "")
1037
- )
1038
- : uni;
1039
- }
1040
-
1041
- return (
1042
- <div
1043
- className={
1044
- currentCompProps.length - 1 == i
1045
- ? "tableHeaderNB dflexRow"
1046
- : "tableHeader dflexRow"
1047
- }
1048
- key={i}
1049
- >
1050
- <span>
1051
- <div>{value}</div>
1052
- </span>
1053
- <span>
1054
- <div>
1055
- {hookArray.length
1056
- ? hookArray.map((value, i) => {
1057
- return (
1058
- <div className="hookOneof" key={i}>
1059
- {value}
1060
- </div>
1061
- );
1062
- })
1063
- : propsObj[value] &&
1064
- propsObj[value].hookType}
1065
- </div>
1066
- </span>
1067
- <span>
1068
- <div>
1069
- {propsObj[value] && propsObj[value].isRequired
1070
- ? "false"
1071
- : "true"}
1072
- </div>
1073
- </span>
1074
- <span>
1075
- <div className="bn">
1076
- {JSON.stringify(currentCompDefault[value])
1077
- ? JSON.stringify(currentCompDefault[value])
1078
- : "-"}
1079
- </div>
1080
- </span>
1081
- <span>
1082
- <div className="bn">
1083
- {propsObjDesc[value] && propsObjDesc[value]}
1084
- </div>
1085
- </span>
1086
- </div>
1087
- );
1088
- })}
1089
- </div>
1090
- </div>
1091
- ) : null}
1092
- </div>
1093
- );
1094
- } else {
1095
- return null;
1096
- }
1097
- })}
1098
- </div>
1099
- );
1100
- }
1101
- }
1102
- // class PlayGround extends React.Component {
1103
- // constructor(props) {
1104
- // super(props);
1105
- // this.state = { propsObject : props.currentCompDefault }
1106
- // }
1107
- // onChangeInput(name,e)
1108
- // {
1109
- // let propsObject = this.state.propsObject
1110
- // propsObject[name] = e.target.value
1111
- // this.setState({propsObject : propsObject })
1112
- // }
1113
- // render()
1114
- // {
1115
- // let {RenderCode,propsObj } = this.props
1116
- // let {propsObject} = this.state;
1117
- // return (
1118
- //
1119
- // <div>
1120
- // <RenderCode {...propsObject}/>
1121
- //
1122
- // {
1123
- // Object.keys(propsObj).map((name)=>{
1124
- // if( propsObj[name].hookType == "string")
1125
- // {
1126
- // return (<span>
1127
- // <label>{name}</label>
1128
- // <input onChange={this.onChangeInput.bind(this,name)}></input>
1129
- // </span>)
1130
- // }
1131
- // else {
1132
- // return null
1133
- // }
1134
- //
1135
- // })
1136
- // }
1137
- // </div>
1138
- // )
1139
- // }
1140
- // }
1141
- //
1142
-
1143
- class StateComponent extends React.Component {
1144
- constructor(props) {
1145
- super(props);
1146
- this.state = {
1147
- codeView: false,
1148
- codeTabView: "react"
1149
- };
1150
- this.codePreview = this.codePreview.bind(this);
1151
- }
1152
- codePreview() {
1153
- this.setState({ codeView: !this.state.codeView });
1154
- }
1155
-
1156
- componentDidMount() {
1157
- let { states, htmlCode, renCode: RenderCode } = this.props;
1158
- // if (typeof CodeMirror !== 'undefined' && document.getElementById(states)) {
1159
- // CodeMirror.fromTextArea(document.getElementById(states), {
1160
- // lineNumbers: false,
1161
- // styleActiveLine: false,
1162
- // matchBrackets: false,
1163
- // theme: 'blackboard',
1164
- // readOnly: true
1165
- // });
1166
- // }
1167
-
1168
- RenderCode &&
1169
- ReactDOM.render(
1170
- <CodeExtractContext.Provider value={{ isCodeExtract: true }}>
1171
- <RenderCode />
1172
- </CodeExtractContext.Provider>,
1173
- document.getElementById(states + "view")
1174
- // htmlCode(states)
1175
- );
1176
- }
1177
-
1178
- onTabChange(text) {
1179
- this.setState({ codeTabView: text });
1180
- }
1181
-
1182
- render() {
1183
- let { states, descr, renCode, htmlCode, srcReact } = this.props;
1184
- let { codeView, codeTabView } = this.state;
1185
- return (
1186
- <div className="renderPart">
1187
- <div>
1188
- <span className="stateName">{states.split("__")[1]}</span>
1189
- <label className="codeToggle">
1190
- <input type="checkbox" onClick={this.codePreview} />
1191
- <div>
1192
- <div>&lt;/&gt;</div>
1193
- </div>
1194
- </label>
1195
- </div>
1196
- <div className="renDes">{descr}</div>
1197
- <div className="renderArea" id={states + "view"}>
1198
- states
1199
- </div>
1200
- <div className={codeView ? "codeView" : "codeArea"}>
1201
- <div className="borderTab">
1202
- <div className="codeTabWrap">
1203
- <span
1204
- className={codeTabView == "react" ? "activeTabCode" : ""}
1205
- onClick={this.onTabChange.bind(this, "react")}
1206
- >
1207
- React Code
1208
- </span>
1209
- <span
1210
- className={codeTabView == "html" ? "activeTabCode" : ""}
1211
- onClick={this.onTabChange.bind(this, "html")}
1212
- >
1213
- HTML Code
1214
- </span>
1215
- </div>
1216
-
1217
- <div
1218
- className={
1219
- codeTabView == "react"
1220
- ? "reactCode viewsubcode"
1221
- : "reactCode hidecode"
1222
- }
1223
- >
1224
- {/* <textarea id={states} defaultValue={srcReact} name={states} /> */}
1225
- </div>
1226
-
1227
- <div
1228
- className={
1229
- codeTabView == "html"
1230
- ? "htmlCode viewsubcode"
1231
- : "htmlCode hidecode"
1232
- }
1233
- >
1234
- {/* <textarea id={'html' + states} name={'html' + states} /> */}
1235
- </div>
1236
- </div>
1237
- </div>
1238
- </div>
1239
- );
1240
- }
1241
- }
1242
-
1243
- class KeyBoardShortcut extends React.Component {
1244
- constructor(props) {
1245
- super(props);
1246
- this.keyVal = "";
1247
- this.pressKey = this.pressKey.bind(this);
1248
- this.toggle = this.toggle.bind(this);
1249
- this.state = {
1250
- keyPress: false
1251
- };
1252
- }
1253
- componentDidMount() {
1254
- // document.addEventListener('keydown', this.pressKey);
1255
- }
1256
- toggle() {
1257
- var clr;
1258
- clr && clearTimeout(clr);
1259
- this.setState({ keyPress: true }, () => {
1260
- clr = setTimeout(() => {
1261
- this.setState({ keyPress: false });
1262
- }, 600);
1263
- });
1264
- }
1265
-
1266
- pressKey(e) {
1267
- var key = e.keyCode;
1268
- this.keyVal = String.fromCharCode(key);
1269
- if (e.target.nodeName == "BODY") {
1270
- switch (key) {
1271
- case 65:
1272
- this.toggle();
1273
- this.props.onSelect("accessibility");
1274
- break;
1275
- case 67:
1276
- this.toggle();
1277
- this.props.onSelect("components");
1278
- break;
1279
- case 68:
1280
- this.toggle();
1281
- this.props.onSelect("designTokens");
1282
- break;
1283
- case 70:
1284
- this.toggle();
1285
- this.props.onSelect("faq");
1286
- break;
1287
- case 71:
1288
- this.toggle();
1289
- this.props.onSelect("gettingStarted");
1290
- break;
1291
- case 73:
1292
- this.toggle();
1293
- this.props.onSelect("icons");
1294
- break;
1295
- case 85:
1296
- this.toggle();
1297
- this.props.onSelect("utilities");
1298
- break;
1299
- }
1300
- }
1301
- }
1302
- render() {
1303
- return (
1304
- <div className={this.state.keyPress ? "keyBoard" : "hide"}>
1305
- <span>{this.keyVal}</span>
1306
- </div>
1307
- );
1308
- }
1309
- }
1310
-
1311
- ReactDOM.render(<App />, react);
1
+ var Component = window.Component;
2
+ var ReactDOM = Component.ReactDOM;
3
+ var React = Component.React;
4
+ import PropTypes from "prop-types";
5
+
6
+ class App extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+ this.state = {
10
+ selected:
11
+ window.location.hash != ""
12
+ ? window.location.hash.split("/")[0].split("#")[1]
13
+ : "gettingStarted",
14
+ theme: "theme1",
15
+ selectedCom:
16
+ window.location.hash != "" ? window.location.hash.split("/")[1] : "",
17
+
18
+ selectedIconComponent:
19
+ window.location.hash != "" ? window.location.hash.split("/")[1] : ""
20
+ };
21
+ this.selectTab = this.selectTab.bind(this);
22
+ this.themeChoosing = this.themeChoosing.bind(this);
23
+ this.selectComponent = this.selectComponent.bind(this);
24
+ this.onSelectIconComponent = this.onSelectIconComponent.bind(this);
25
+ this.setTooltipRef = this.setTooltipRef.bind(this);
26
+ }
27
+ selectComponent(comp, isScroll) {
28
+ if (isScroll) {
29
+ history.replaceState("", "", "#components/" + comp);
30
+ } else {
31
+ window.location.hash = "components/" + comp;
32
+ }
33
+ this.setState({ selectedCom: comp });
34
+ }
35
+ selectTab(tab) {
36
+ window.location.hash = tab;
37
+ this.setState({ selected: tab });
38
+ }
39
+
40
+ themeChoosing(theme) {
41
+ this.selectTab("designTokens");
42
+ this.setState({ theme: theme });
43
+ }
44
+
45
+ onSelectIconComponent(selectedIconComponent) {
46
+ this.setState({ selectedIconComponent: selectedIconComponent });
47
+ }
48
+
49
+ setTooltipRef(ref) {
50
+ this.tooltipRef = ref;
51
+ }
52
+ render() {
53
+ let { selected, theme, selectedCom, selectedIconComponent } = this.state;
54
+
55
+ let renderComp = {};
56
+ Object.keys(Component).forEach(val => {
57
+ let out =
58
+ val.indexOf("__") != -1 ||
59
+ val == "React" ||
60
+ val == "ReactDOM" ||
61
+ val == "renderToStaticMarkup"
62
+ ? false
63
+ : true;
64
+ if (
65
+ val.indexOf("__") != -1 &&
66
+ Component[val.split("__")[0]].docs.external
67
+ ) {
68
+ if (renderComp[val.split("__")[0]] == undefined) {
69
+ renderComp[val.split("__")[0]] = [];
70
+ }
71
+ renderComp[val.split("__")[0]].push(val);
72
+ }
73
+ });
74
+
75
+ selectedCom = selectedCom ? selectedCom : Object.keys(renderComp)[0];
76
+
77
+ let fonticonlist = [];
78
+ Component &&
79
+ Object.keys(Component).map(name => {
80
+ if (name.indexOf("FontIcon__") != -1 && name != "FontIcon__All") {
81
+ fonticonlist.push(name.split("__")[1]);
82
+ }
83
+ });
84
+
85
+ selectedIconComponent = selectedIconComponent
86
+ ? selectedIconComponent
87
+ : fonticonlist[0];
88
+ let renderCompIcon =
89
+ Component[selectedIconComponent + "FontIcon__" + selectedIconComponent];
90
+ let Tooltip = Component.Tooltip ? Component.Tooltip : null;
91
+ return (
92
+ <div onMouseOver={e => this.tooltipRef && this.tooltipRef.handleOver(e)}>
93
+ <div>
94
+ <div className="main dflexCol">
95
+ {Component.Tooltip && (
96
+ <Component.Tooltip ref={this.setTooltipRef} />
97
+ )}
98
+
99
+ <Header
100
+ onSelect={this.selectTab}
101
+ selected={selected}
102
+ themeChoosing={this.themeChoosing}
103
+ theme={theme}
104
+ />
105
+
106
+ {selected == "components" ? (
107
+ <div className="container dflexRow flex1">
108
+ <LeftPanel
109
+ module="components"
110
+ dummy={true}
111
+ list={Object.keys(renderComp)}
112
+ selectComponent={this.selectComponent}
113
+ selectedCom={selectedCom}
114
+ />
115
+ <RightPanel
116
+ module="components"
117
+ selectedCom={selectedCom}
118
+ renderComp={renderComp}
119
+ selectComponent={this.selectComponent}
120
+ />
121
+ </div>
122
+ ) : null}
123
+
124
+ {selected == "gettingStarted" ? (
125
+ <div className="container dflexRow flex1">
126
+ <GettingStarted />
127
+ </div>
128
+ ) : null}
129
+
130
+ {selected == "accessibility" ? (
131
+ <div className="container dflexRow flex1">
132
+ <Accessibility />
133
+ </div>
134
+ ) : null}
135
+
136
+ {selected == "designTokens" ? (
137
+ <div className="container dflexRow flex1">
138
+ <DesignTokens theme={theme} />
139
+ </div>
140
+ ) : null}
141
+
142
+ {selected == "utilities" ? (
143
+ <div className="container dflexRow flex1">
144
+ <Utilities theme={theme} />
145
+ </div>
146
+ ) : null}
147
+
148
+ {selected == "icons" ? (
149
+ <div className="container dflexRow flex1">
150
+ <LeftPanel
151
+ module="icons"
152
+ list={fonticonlist}
153
+ selectComponent={this.onSelectIconComponent}
154
+ selectedCom={selectedIconComponent}
155
+ />
156
+
157
+ <IconComponentRender
158
+ component={renderCompIcon}
159
+ heading={selectedIconComponent}
160
+ />
161
+ </div>
162
+ ) : null}
163
+
164
+ {selected == "faq" ? (
165
+ <div className="container dflexRow flex1">
166
+ <div className="faqs">FAQS Coming soon..</div>
167
+ </div>
168
+ ) : null}
169
+ </div>
170
+ </div>
171
+ </div>
172
+ );
173
+ }
174
+ }
175
+
176
+ class IconComponentRender extends React.Component {
177
+ constructor(props) {
178
+ super(props);
179
+ }
180
+
181
+ render() {
182
+ let { component, heading } = this.props;
183
+ let RenderComponent = component ? component : null;
184
+ return (
185
+ <div className="rightPanel flex1">
186
+ <div className="iconCont">
187
+ <h1 className="compName">
188
+ {heading.replace(/([A-Z])/g, " $1").trim()}
189
+ </h1>
190
+ <div className="codeHint">
191
+ <div>
192
+ {" "}
193
+ {"import " +
194
+ heading +
195
+ "FontIcon from @zohodesk/components/lib/FontIcon/" +
196
+ heading +
197
+ "FontIcon"}{" "}
198
+ </div>
199
+ <div>
200
+ {" "}
201
+ {"<" + heading + 'FontIcon name="iconName" size="small"/> '}{" "}
202
+ </div>
203
+ </div>
204
+ <div className="wicon">
205
+ {RenderComponent ? (
206
+ <RenderComponent CopyComp={CopyTextComp} />
207
+ ) : null}
208
+ </div>{" "}
209
+ </div>
210
+ </div>
211
+ );
212
+ }
213
+ }
214
+
215
+ class Header extends React.Component {
216
+ constructor(props) {
217
+ super(props);
218
+ this.state = {
219
+ popup: false,
220
+ toggleMenuTop: false,
221
+ rtlView: false
222
+ };
223
+ this.popupToggle = this.popupToggle.bind(this);
224
+ this.popupHide = this.popupHide.bind(this);
225
+ this.toggleMenu = this.toggleMenu.bind(this);
226
+ this.removeClose = this.removeClose.bind(this);
227
+ }
228
+ componentWillMount() {
229
+ document.addEventListener("click", this.popupHide);
230
+ }
231
+ componentWillUnmount() {
232
+ document.removeEventListener("click", this.popupHide);
233
+ }
234
+ popupToggle(e) {
235
+ this.setState({ popup: !this.state.popup });
236
+ this.removeClose(e);
237
+ }
238
+ popupHide() {
239
+ this.setState({ popup: false });
240
+ this.setState({ toggleMenuTop: false });
241
+ }
242
+ removeClose(e) {
243
+ e.stopPropagation && e.stopPropagation();
244
+ e.nativeEvent.stopImmediatePropagation &&
245
+ e.nativeEvent.stopImmediatePropagation();
246
+ }
247
+ toggleMenu() {
248
+ this.setState({ toggleMenuTop: !this.state.toggleMenuTop });
249
+ }
250
+ onClickRtl() {
251
+ this.setState({ rtlView: !this.state.rtlView });
252
+ if (!this.state.rtlView) {
253
+ document.querySelector("html").setAttribute("dir", "rtl");
254
+ } else {
255
+ document.querySelector("html").setAttribute("dir", "ltr");
256
+ }
257
+ }
258
+ render() {
259
+ let { onSelect, selected, themeChoosing, theme } = this.props;
260
+ let { popup, toggleMenuTop, rtlView } = this.state;
261
+ return (
262
+ <div className="header dflex">
263
+ <div className="headerLeftimg" />
264
+ <div className="hdrTabs">
265
+ <button
266
+ tabIndex="1"
267
+ className={selected == "gettingStarted" ? "activeTab" : ""}
268
+ onClick={onSelect.bind(this, "gettingStarted")}
269
+ >
270
+ Getting Started
271
+ </button>
272
+ <button
273
+ tabIndex="3"
274
+ className={selected == "designTokens" ? "activeTab" : ""}
275
+ onClick={onSelect.bind(this, "designTokens")}
276
+ >
277
+ Design Tokens
278
+ </button>
279
+
280
+ <button
281
+ tabIndex="4"
282
+ className={selected == "components" ? "activeTab" : ""}
283
+ onClick={onSelect.bind(this, "components")}
284
+ >
285
+ Components
286
+ </button>
287
+ <button
288
+ tabIndex="6"
289
+ className={selected == "icons" ? "activeTab" : ""}
290
+ onClick={onSelect.bind(this, "icons")}
291
+ >
292
+ Icons
293
+ </button>
294
+ </div>
295
+ <svg
296
+ className={rtlView ? "rtlIcnActv rtlIcn" : "rtlIcn"}
297
+ onClick={this.onClickRtl.bind(this, "rtl")}
298
+ >
299
+ <use xlinkHref="#icon-rtl" />
300
+ </svg>
301
+ </div>
302
+ );
303
+ }
304
+ }
305
+
306
+ class GettingStarted extends React.Component {
307
+ constructor(props) {
308
+ super(props);
309
+ }
310
+
311
+ render() {
312
+ return (
313
+ <div className="getting">
314
+ <div>
315
+ <div className="centerIcon">
316
+ <svg className="deskIcon">
317
+ <use xlinkHref="#icon-desk" />
318
+ </svg>
319
+ </div>
320
+ <div className="gettingHd">Zoho Desk Style Guide</div>
321
+ <div className="gtngDescrpt">
322
+ {
323
+ "You can use any Frontend framework to design your app. We have provided UI library to get ZohoDesk's UI in your app. Since you are using our UI library you can feel the ZohoDesk's UI experience in your app. We were using the components from our library to develop our product. So we hope you are happy with these components library. To get the UI similar to ZohoDesk we are providing CSS and React components and you can use that to develop your app."
324
+ }
325
+ </div>
326
+ <div className="mainObjSec">
327
+ <div>
328
+ The Main Objective of Zoho Desk help Component will be Provide{" "}
329
+ </div>
330
+ <ul>
331
+ <li>Semantic and Accessible component markup</li>
332
+ <li>Cross browser compatible CSS</li>
333
+ <li>Icons & Fonts</li>
334
+ </ul>
335
+ </div>
336
+ <div className="package">
337
+ We are exposing our components library based on{" "}
338
+ <span className="cssURLtext">
339
+ CDN URL
340
+ <div className="cdnUrl">
341
+ <span>
342
+ https://localjs.zohostatic.com/support/zohodeskcomponent@0.0.0-alpha-0/dist/styles.css
343
+ </span>
344
+ <span id="cssURL" className="copyTxtHiden">
345
+ https://localjs.zohostatic.com/support/zohodeskcomponent@0.0.0-alpha-0/dist/styles.css
346
+ </span>
347
+ <svg
348
+ className="cpyIcnCmn cpyCdn"
349
+ onClick={selectText.bind(this, "cssURL")}
350
+ >
351
+ <use xlinkHref="#icon-copy" />
352
+ </svg>
353
+ </div>
354
+ </span>{" "}
355
+ and{" "}
356
+ <span>
357
+ <span>
358
+ NPM Package( npm install @zohodesk/components
359
+ <span id="npminstall" className="copyTxtHiden">
360
+ npm install @zohodesk/components
361
+ </span>
362
+ <svg
363
+ className="cpyNpm"
364
+ onClick={selectText.bind(this, "npminstall")}
365
+ >
366
+ <use xlinkHref="#icon-copy" />
367
+ </svg>{" "}
368
+ )
369
+ </span>
370
+ </span>
371
+ </div>
372
+ </div>
373
+ </div>
374
+ );
375
+ }
376
+ }
377
+
378
+ class Accessibility extends React.Component {
379
+ constructor(props) {
380
+ super(props);
381
+ }
382
+
383
+ render() {
384
+ return (
385
+ <div className="accessBG">
386
+ <div className="accessibility">
387
+ <div className="accessR">
388
+ <div className="accessHead">Overview</div>
389
+ <div className="accessCon">
390
+ To address the people with disabilities,We are compliance with
391
+ accessible Rich Indent applicatiopns (ARIA)
392
+ </div>
393
+ </div>
394
+
395
+ <div className="accessR">
396
+ <div className="accessHead">KeyBoard Navigations</div>
397
+ <div className="accessCon">
398
+ While we do not provide the JavaScript that is necessary to make
399
+ our components interactive, in the Accessibility Patterns, we
400
+ provide working examples of basic patterns with documentation on
401
+ what interactions are required. There is also advice in the
402
+ individual component’s documentation on how to create
403
+ keyboard-accessible components.
404
+ </div>
405
+ </div>
406
+
407
+ <div className="accessR">
408
+ <div className="accessHead">Accessible Forms</div>
409
+ <div className="accessCon">
410
+ Our forms offer proper use of "fieldset" and "legend" tags as well
411
+ as appropriate labeling for input controls. Our radio button and
412
+ checkbox controls provide a balanced solution that offers
413
+ accessibility as well as design flexibility.
414
+ </div>
415
+ </div>
416
+
417
+ <div className="accessR">
418
+ <div className="accessHead">Appropriate use of color</div>
419
+ <div className="accessCon">
420
+ Our components follow the two main rules of accessibility as it
421
+ relates to color:
422
+ <p>
423
+ We never use color as the only means of providing information or
424
+ requesting an action.
425
+ </p>
426
+ <p>
427
+ The combinations of text and their background colors do not fall
428
+ below the WCAG recommended threshold ratio of 4.5:1 for
429
+ standard.
430
+ </p>
431
+ </div>
432
+ </div>
433
+ </div>
434
+ </div>
435
+ );
436
+ }
437
+ }
438
+
439
+ class DesignTokens extends React.Component {
440
+ constructor(props) {
441
+ super(props);
442
+ this.state = {
443
+ selectedCom:
444
+ window.location.hash != "" ? window.location.hash.split("/")[1] : ""
445
+ };
446
+ this.selectComponent = this.selectComponent.bind(this);
447
+ }
448
+ selectComponent(comp) {
449
+ window.location.hash = "designTokens/" + comp;
450
+ this.setState({ selectedCom: comp });
451
+ }
452
+ render() {
453
+ let { theme } = this.props;
454
+ let { selectedCom } = this.state;
455
+ let menuList = ["Background Color", "Text Color", "Border Color", "Shadow"];
456
+
457
+ // 'Opacity',
458
+ // 'Line Height',
459
+ // 'Spacing',
460
+ // 'Radius',
461
+ // 'Sizing',
462
+ // 'Time',
463
+ // 'Media Query',
464
+ // 'Z-Index'
465
+ //'Font',
466
+ //'Font Size'
467
+
468
+ selectedCom = selectedCom ? selectedCom : menuList[0];
469
+
470
+ selectedCom = decodeURI(selectedCom);
471
+ return (
472
+ <React.Fragment>
473
+ <LeftPanel
474
+ module="designTokens"
475
+ list={menuList}
476
+ selectedCom={selectedCom}
477
+ selectComponent={this.selectComponent}
478
+ />
479
+ <DesignTokenView theme={theme} selectedCom={selectedCom} />
480
+ </React.Fragment>
481
+ );
482
+ }
483
+ }
484
+
485
+ class Search extends React.Component {
486
+ constructor(props) {
487
+ super(props);
488
+ this.state = {
489
+ input: false
490
+ };
491
+ this.focusInput = this.focusInput.bind(this);
492
+ this.blurInput = this.blurInput.bind(this);
493
+ }
494
+ focusInput() {
495
+ this.setState({ input: true });
496
+ }
497
+ blurInput() {
498
+ this.setState({ input: false });
499
+ }
500
+
501
+ render() {
502
+ let { theme } = this.props;
503
+ let { input } = this.state;
504
+ return (
505
+ <div className={input ? "inputBox inputBoxFocus" : "inputBox"}>
506
+ <svg
507
+ className={input ? "icon icon-search inSearch" : "icon icon-search"}
508
+ >
509
+ <use xlinkHref="#icon-search" />
510
+ </svg>
511
+ <input type="text" onFocus={this.focusInput} onBlur={this.blurInput} />
512
+ </div>
513
+ );
514
+ }
515
+ }
516
+
517
+ class CopyTextComp extends React.Component {
518
+ constructor(props) {
519
+ super(props);
520
+ this.state = {
521
+ isCopied: false
522
+ };
523
+ this.onCopy = this.onCopy.bind(this);
524
+ this.onCopied = this.onCopied.bind(this);
525
+ }
526
+ onCopy(copyTxt) {
527
+ this.setState({
528
+ isCopied: true
529
+ });
530
+ selectText(copyTxt);
531
+ }
532
+
533
+ onCopied() {
534
+ let element = this.element;
535
+ this.setState({
536
+ isCopied: false
537
+ });
538
+ element.removeEventListener("webkitAnimationEnd", this.onCopied);
539
+ element.removeEventListener("animationend", this.onCopied);
540
+ }
541
+
542
+ componentDidUpdate() {
543
+ let element = this.element;
544
+ element && element.addEventListener("webkitAnimationEnd", this.onCopied);
545
+ element && element.addEventListener("animationend", this.onCopied);
546
+ }
547
+
548
+ render() {
549
+ let { isCopy, copyTxt } = this.props;
550
+ let { isCopied } = this.state;
551
+ return (
552
+ <div
553
+ className={isCopied ? "copyDv isCopied" : "copyDv"}
554
+ onClick={this.onCopy.bind(this, copyTxt)}
555
+ >
556
+ <div id={copyTxt} className="copyTxtHiden">
557
+ {copyTxt}
558
+ </div>
559
+ <div className="cpyBtn">Copy</div>
560
+ {isCopied && (
561
+ <div
562
+ ref={ele => {
563
+ this.element = ele;
564
+ }}
565
+ className="copiedTxt"
566
+ >
567
+ Copied!
568
+ </div>
569
+ )}
570
+ </div>
571
+ );
572
+ }
573
+ }
574
+ CopyTextComp.propTypes = {
575
+ isCopy: PropTypes.bool,
576
+ copyTxt: PropTypes.string
577
+ };
578
+
579
+ class DesignTokenView extends React.Component {
580
+ constructor(props) {
581
+ super(props);
582
+ this.setTooltipRef = this.setTooltipRef.bind(this);
583
+ }
584
+ componentDidMount() {
585
+ let fontsizecom = Component["FontSize"];
586
+ fontsizecom &&
587
+ ReactDOM.render(
588
+ React.createElement(fontsizecom),
589
+ document.getElementById("fontsize")
590
+ );
591
+ }
592
+
593
+ setTooltipRef(ref) {
594
+ this.tooltipRef = ref;
595
+ }
596
+
597
+ render() {
598
+ let { theme, module, selectedCom } = this.props;
599
+ var backgroundColor = designTokens[theme]["backgroundColor"] || {};
600
+ var textColor = designTokens[theme]["textColor"] || {};
601
+ var borderColor = designTokens[theme]["borderColor"] || {};
602
+ var shadowColor = designTokens[theme]["shadowColor"] || {};
603
+ let Tooltip = Component.Tooltip ? Component.Tooltip : null;
604
+
605
+ return (
606
+ <div
607
+ className="rightPanel flex1"
608
+ onMouseOver={e => this.tooltipRef && this.tooltipRef.handleOver(e)}
609
+ >
610
+ <Tooltip ref={this.setTooltipRef} />
611
+
612
+ <div className="designTokenDet">
613
+ {selectedCom == "Background Color" ? (
614
+ <React.Fragment>
615
+ {
616
+ // <h2 className="compName" id="designTokens/Background Color">
617
+ // Background Colors
618
+ // </h2>
619
+ }
620
+ <div className="renderContent">
621
+ Use these CSS variables for Background colors.
622
+ </div>
623
+ {Object.keys(backgroundColor).map((color, i) => {
624
+ return (
625
+ <div key={i} className="colorShow clipBoard">
626
+ <div
627
+ style={{ background: backgroundColor[color] }}
628
+ className="colorDv"
629
+ />
630
+ <div className="colorName">
631
+ <div data-title={color}> {color} </div>
632
+ <div data-title={backgroundColor[color]}>
633
+ {" "}
634
+ {backgroundColor[color]}{" "}
635
+ </div>
636
+ </div>
637
+ <CopyTextComp copyTxt={`var(${color})`} />
638
+ </div>
639
+ );
640
+ })}
641
+ </React.Fragment>
642
+ ) : null}
643
+
644
+ {selectedCom == "Text Color" ? (
645
+ <React.Fragment>
646
+ {
647
+ // <h2 className="compName" id="designTokens/Text Color">
648
+ // Text Colors
649
+ // </h2>
650
+ }
651
+ <div className="renderContent">
652
+ <p>Use these CSS variables for Text colors.</p>
653
+ </div>
654
+ {Object.keys(textColor).map((color, i) => {
655
+ return (
656
+ <div key={i} className="colorShow clipBoard">
657
+ <div id={color} className="copyTxtHiden">
658
+ {" "}
659
+ {color}
660
+ </div>
661
+ <div
662
+ style={{ background: textColor[color] }}
663
+ className="colorDv"
664
+ />
665
+ <div className="colorName">
666
+ <div data-title={color}> {color} </div>
667
+ <div data-title={textColor[color]}>
668
+ {" "}
669
+ {textColor[color]}{" "}
670
+ </div>
671
+ </div>
672
+ <CopyTextComp copyTxt={`color:var(${color})`} />
673
+ </div>
674
+ );
675
+ })}
676
+ </React.Fragment>
677
+ ) : null}
678
+
679
+ {selectedCom == "Border Color" ? (
680
+ <React.Fragment>
681
+ {
682
+ // <h2 className="compName" id="designTokens/Border Color">
683
+ // Border Colors
684
+ // </h2>
685
+ }
686
+ <div className="renderContent">
687
+ <p>Use these CSS variables for Border colors.</p>
688
+ </div>
689
+ {Object.keys(borderColor).map((color, i) => {
690
+ return (
691
+ <div key={i} className="colorShow clipBoard">
692
+ <div id={color} className="copyTxtHiden">
693
+ {" "}
694
+ {color}
695
+ </div>
696
+ <div
697
+ style={{ background: borderColor[color] }}
698
+ className="colorDv"
699
+ />
700
+ <div className="colorName">
701
+ <div data-title={color}> {color} </div>
702
+ <div data-title={borderColor[color]}>
703
+ {" "}
704
+ {borderColor[color]}{" "}
705
+ </div>
706
+ </div>
707
+ <CopyTextComp copyTxt={`var(${color})`} />
708
+ </div>
709
+ );
710
+ })}
711
+ </React.Fragment>
712
+ ) : null}
713
+
714
+ {selectedCom == "Shadow" ? (
715
+ <React.Fragment>
716
+ {
717
+ // <h2 className="compName" id="designTokens/Shadow">
718
+ // Shadow Colors
719
+ // </h2>
720
+ }
721
+ <div className="renderContent">
722
+ <p>Use these CSS variables for Shadow colors.</p>
723
+ </div>
724
+ {Object.keys(shadowColor).map((color, i) => {
725
+ return (
726
+ <div key={i} className="colorShow clipBoard">
727
+ <div id={color} className="copyTxtHiden">
728
+ {" "}
729
+ {color}
730
+ </div>
731
+ <div
732
+ style={{ background: shadowColor[color] }}
733
+ className="colorDv"
734
+ />
735
+ <div className="colorName">
736
+ <div data-title={color}> {color} </div>
737
+ <div data-title={shadowColor[color]}>
738
+ {" "}
739
+ {shadowColor[color]}{" "}
740
+ </div>
741
+ </div>
742
+ <CopyTextComp copyTxt={`var(${color})`} />
743
+ </div>
744
+ );
745
+ })}
746
+ </React.Fragment>
747
+ ) : null}
748
+
749
+ {selectedCom == "Font Size" ? (
750
+ <div>
751
+ <h2 className="compName" id="designTokens/Font Size">
752
+ Font Size
753
+ </h2>
754
+ <div className="renderContent">
755
+ <p>Use these tokens for Font Size only.</p>
756
+ </div>
757
+ <div className="bgColors">
758
+ <div id="fontsize" />
759
+ </div>
760
+ </div>
761
+ ) : null}
762
+ </div>
763
+ </div>
764
+ );
765
+ }
766
+ }
767
+
768
+ class Utilities extends React.Component {
769
+ constructor(props) {
770
+ super(props);
771
+ this.state = {
772
+ selectedCom:
773
+ window.location.hash != "" ? window.location.hash.split("/")[1] : ""
774
+ };
775
+ this.selectComponent = this.selectComponent.bind(this);
776
+ }
777
+ selectComponent(comp) {
778
+ window.location.hash = "utilities/" + comp;
779
+ this.setState({ selectedCom: comp });
780
+ }
781
+
782
+ render() {
783
+ let { list } = this.props;
784
+ let { selectedCom } = this.state;
785
+ var utilitiesList = [
786
+ "Alignment",
787
+ "Borders",
788
+ "Box",
789
+ "Margin",
790
+ "Padding",
791
+ "Floats",
792
+ "Grid",
793
+ "Horizontal List",
794
+ "Interactions",
795
+ "Layout",
796
+ "Position"
797
+ ];
798
+ return (
799
+ <LeftPanel
800
+ module="utilities"
801
+ selectedCom={selectedCom}
802
+ list={utilitiesList}
803
+ selectComponent={this.selectComponent}
804
+ />
805
+ );
806
+ }
807
+ }
808
+
809
+ class LeftPanel extends React.Component {
810
+ constructor(props) {
811
+ super(props);
812
+ this.state = {
813
+ toggleLeft: false
814
+ };
815
+ this.toggleLeftBar = this.toggleLeftBar.bind(this);
816
+ this.mobLeftHide = this.mobLeftHide.bind(this);
817
+ }
818
+ toggleLeftBar() {
819
+ this.setState({ toggleLeft: !this.state.toggleLeft });
820
+ }
821
+ mobLeftHide(name) {
822
+ this.setState({ toggleLeft: false });
823
+ this.props.selectComponent(name);
824
+ }
825
+ componentDidUpdate() {
826
+ let ele = this.leftPanel.getElementsByClassName("compAct")[0];
827
+
828
+ if (ele) {
829
+ let top = ele.getBoundingClientRect().top;
830
+ if (top < 56) {
831
+ this.leftPanel.scrollTop = ele.offsetTop - this.leftPanel.offsetTop;
832
+ } else if (top > window.innerHeight - 100) {
833
+ this.leftPanel.scrollTop = ele.offsetTop + window.innerHeight - 100;
834
+ }
835
+ }
836
+ }
837
+ render() {
838
+ let { list, selectComponent, selectedCom, dummy, module } = this.props;
839
+ let { toggleLeft } = this.state;
840
+
841
+ return (
842
+ <div
843
+ className={toggleLeft ? "leftPanel leftPanelShow" : "leftPanel"}
844
+ ref={leftPanel => {
845
+ this.leftPanel = leftPanel;
846
+ }}
847
+ >
848
+ {list.map((name, i) => {
849
+ return (
850
+ <a
851
+ className={selectedCom == name ? "compAct" : "comp"}
852
+ key={i}
853
+ href={"#" + module + "/" + name}
854
+ onClick={this.mobLeftHide.bind(this, name)}
855
+ >
856
+ {name}
857
+ </a>
858
+ );
859
+ })}
860
+ </div>
861
+ );
862
+ }
863
+ }
864
+
865
+ class RightPanel extends React.Component {
866
+ constructor(props) {
867
+ super(props);
868
+ // this.htmlCode = this.htmlCode.bind(this);
869
+ this.stopEvent = this.stopEvent.bind(this);
870
+ this.scrollCom = this.scrollCom.bind(this);
871
+ }
872
+
873
+ stopEvent(e) {
874
+ e.preventDefault();
875
+ }
876
+
877
+ // htmlCode(name) {
878
+ // var code = Component.renderToStaticMarkup(
879
+ // React.createElement(Component[name])
880
+ // );
881
+
882
+ // document.getElementById('html' + name).value = global.process(code);
883
+
884
+ // if (
885
+ // typeof CodeMirror !== 'undefined' &&
886
+ // document.getElementById('html' + name)
887
+ // ) {
888
+ // CodeMirror.fromTextArea(document.getElementById('html' + name), {
889
+ // lineNumbers: false,
890
+ // styleActiveLine: false,
891
+ // matchBrackets: false,
892
+ // theme: 'blackboard',
893
+ // readOnly: true
894
+ // });
895
+ // }
896
+
897
+ // let stopAHref = document.querySelectorAll('.renderCom a');
898
+ // stopAHref.forEach(ele => {
899
+ // ele.addEventListener('click', this.stopEvent);
900
+ // });
901
+ // }
902
+
903
+ scrollCom(e) {
904
+ let child = e.target.childNodes || {};
905
+ let { selectedCom, selectComponent } = this.props;
906
+
907
+ Object.keys(child).forEach(val => {
908
+ if (
909
+ child[val].getBoundingClientRect().top < 54 &&
910
+ child[val].getBoundingClientRect().top > 0
911
+ ) {
912
+ let comp = child[val].getAttribute("id").split("/")[1];
913
+ selectedCom !== comp ? selectComponent(comp, true) : null;
914
+ }
915
+ });
916
+ }
917
+
918
+ render() {
919
+ let { selectedCom, renderComp, module } = this.props;
920
+ return (
921
+ <div className="rightPanel flex1">
922
+ {Object.keys(renderComp).map((comName, i) => {
923
+ let description =
924
+ Component[comName].docs && Component[comName].docs.description
925
+ ? Component[comName].docs.description
926
+ : "No description for " + comName;
927
+
928
+ let rendering = false;
929
+ renderComp[comName].forEach((sub, k) => {
930
+ let a = sub.split("__")[0];
931
+ rendering = a == selectedCom ? true : false;
932
+ });
933
+
934
+ if (rendering) {
935
+ let propsObj =
936
+ (Component &&
937
+ Component[selectedCom] &&
938
+ // eslint-disable-next-line react/forbid-foreign-prop-types
939
+ Component[selectedCom].propTypes) ||
940
+ {};
941
+ let propsObjDesc =
942
+ (Component &&
943
+ Component[selectedCom] &&
944
+ Component[selectedCom].propTypesDescription) ||
945
+ {};
946
+ let currentCompProps = Object.keys(propsObjDesc) || [];
947
+ let currentCompDefault =
948
+ (Component[selectedCom] && Component[selectedCom].defaultProps) ||
949
+ {};
950
+
951
+ let additinonalDesc =
952
+ (Component[selectedCom].docs.additionalDescription &&
953
+ Component[selectedCom].docs.additionalDescription) ||
954
+ null;
955
+
956
+ return (
957
+ <div key={i} className="renderCom" id={module + "/" + comName}>
958
+ <h1 className="compName">{comName}</h1>
959
+ <p className="compDesc">{description}</p>
960
+
961
+ <div dangerouslySetInnerHTML={{ __html: additinonalDesc }} />
962
+
963
+ {
964
+ // {PlayGround ? (
965
+ // <div className="playGround">
966
+ // <PlayGround propsObj={propsObj} RenderCode={Component[comName] } currentCompDefault={currentCompDefault}/>
967
+ // </div>
968
+ // ) : null}
969
+ }
970
+ {
971
+ // let PlayGround =
972
+ // renderComp[comName].indexOf(comName + '__PlayGround') == -1
973
+ // ? null
974
+ // : Component[comName + '__PlayGround'];
975
+ }
976
+
977
+ {renderComp[comName].map((states, j) => {
978
+ let srcReact =
979
+ Component[states].docs && Component[states].docs.source
980
+ ? Component[states].docs.source
981
+ : "no Code";
982
+ let descr =
983
+ Component[states].docs && Component[states].docs.description
984
+ ? Component[states].docs.description
985
+ : "No description for " + states.split("__")[1];
986
+
987
+ if (states.split("__")[1] != "PlayGround") {
988
+ return (
989
+ <StateComponent
990
+ key={j}
991
+ states={states}
992
+ descr={descr}
993
+ srcReact={srcReact}
994
+ renCode={Component[states]}
995
+ />
996
+ );
997
+ } else {
998
+ return null;
999
+ }
1000
+ })}
1001
+ {Object.keys(currentCompProps).length ? (
1002
+ <div>
1003
+ <div className="proprti">Properties</div>
1004
+ <div className="propTable">
1005
+ <div className="tableHeader dflexRow">
1006
+ <span className="brR">PropsName</span>
1007
+ <span className="brR">Type</span>
1008
+ <span className="brR">isRequired</span>
1009
+ <span className="brR bn">Default Props</span>
1010
+ <span className="brR bn">Description</span>
1011
+ </div>
1012
+
1013
+ {currentCompProps.length &&
1014
+ currentCompProps.map((value, i) => {
1015
+ let hookArray = [];
1016
+ if (
1017
+ propsObj[value] &&
1018
+ propsObj[value].hookType &&
1019
+ (propsObj[value].hookType.indexOf("enum") != -1 ||
1020
+ propsObj[value].hookType.indexOf("union") != -1)
1021
+ ) {
1022
+ let uni = "";
1023
+ if (
1024
+ propsObj[value].hookType.indexOf("union") != -1
1025
+ ) {
1026
+ let val = propsObj[value].hookType;
1027
+ let a = val.replace("union", "");
1028
+ a = a.replace("]", "");
1029
+ a = a.replace("[", "");
1030
+ uni = a.split(",");
1031
+ }
1032
+
1033
+ hookArray =
1034
+ propsObj[value].hookType.indexOf("enum") != -1
1035
+ ? JSON.parse(
1036
+ propsObj[value].hookType.replace("enum", "")
1037
+ )
1038
+ : uni;
1039
+ }
1040
+
1041
+ return (
1042
+ <div
1043
+ className={
1044
+ currentCompProps.length - 1 == i
1045
+ ? "tableHeaderNB dflexRow"
1046
+ : "tableHeader dflexRow"
1047
+ }
1048
+ key={i}
1049
+ >
1050
+ <span>
1051
+ <div>{value}</div>
1052
+ </span>
1053
+ <span>
1054
+ <div>
1055
+ {hookArray.length
1056
+ ? hookArray.map((value, i) => {
1057
+ return (
1058
+ <div className="hookOneof" key={i}>
1059
+ {value}
1060
+ </div>
1061
+ );
1062
+ })
1063
+ : propsObj[value] &&
1064
+ propsObj[value].hookType}
1065
+ </div>
1066
+ </span>
1067
+ <span>
1068
+ <div>
1069
+ {propsObj[value] && propsObj[value].isRequired
1070
+ ? "false"
1071
+ : "true"}
1072
+ </div>
1073
+ </span>
1074
+ <span>
1075
+ <div className="bn">
1076
+ {JSON.stringify(currentCompDefault[value])
1077
+ ? JSON.stringify(currentCompDefault[value])
1078
+ : "-"}
1079
+ </div>
1080
+ </span>
1081
+ <span>
1082
+ <div className="bn">
1083
+ {propsObjDesc[value] && propsObjDesc[value]}
1084
+ </div>
1085
+ </span>
1086
+ </div>
1087
+ );
1088
+ })}
1089
+ </div>
1090
+ </div>
1091
+ ) : null}
1092
+ </div>
1093
+ );
1094
+ } else {
1095
+ return null;
1096
+ }
1097
+ })}
1098
+ </div>
1099
+ );
1100
+ }
1101
+ }
1102
+ // class PlayGround extends React.Component {
1103
+ // constructor(props) {
1104
+ // super(props);
1105
+ // this.state = { propsObject : props.currentCompDefault }
1106
+ // }
1107
+ // onChangeInput(name,e)
1108
+ // {
1109
+ // let propsObject = this.state.propsObject
1110
+ // propsObject[name] = e.target.value
1111
+ // this.setState({propsObject : propsObject })
1112
+ // }
1113
+ // render()
1114
+ // {
1115
+ // let {RenderCode,propsObj } = this.props
1116
+ // let {propsObject} = this.state;
1117
+ // return (
1118
+ //
1119
+ // <div>
1120
+ // <RenderCode {...propsObject}/>
1121
+ //
1122
+ // {
1123
+ // Object.keys(propsObj).map((name)=>{
1124
+ // if( propsObj[name].hookType == "string")
1125
+ // {
1126
+ // return (<span>
1127
+ // <label>{name}</label>
1128
+ // <input onChange={this.onChangeInput.bind(this,name)}></input>
1129
+ // </span>)
1130
+ // }
1131
+ // else {
1132
+ // return null
1133
+ // }
1134
+ //
1135
+ // })
1136
+ // }
1137
+ // </div>
1138
+ // )
1139
+ // }
1140
+ // }
1141
+ //
1142
+
1143
+ class StateComponent extends React.Component {
1144
+ constructor(props) {
1145
+ super(props);
1146
+ this.state = {
1147
+ codeView: false,
1148
+ codeTabView: "react"
1149
+ };
1150
+ this.codePreview = this.codePreview.bind(this);
1151
+ }
1152
+ codePreview() {
1153
+ this.setState({ codeView: !this.state.codeView });
1154
+ }
1155
+
1156
+ componentDidMount() {
1157
+ let { states, htmlCode, renCode: RenderCode } = this.props;
1158
+ // if (typeof CodeMirror !== 'undefined' && document.getElementById(states)) {
1159
+ // CodeMirror.fromTextArea(document.getElementById(states), {
1160
+ // lineNumbers: false,
1161
+ // styleActiveLine: false,
1162
+ // matchBrackets: false,
1163
+ // theme: 'blackboard',
1164
+ // readOnly: true
1165
+ // });
1166
+ // }
1167
+
1168
+ RenderCode &&
1169
+ ReactDOM.render(
1170
+ <CodeExtractContext.Provider value={{ isCodeExtract: true }}>
1171
+ <RenderCode />
1172
+ </CodeExtractContext.Provider>,
1173
+ document.getElementById(states + "view")
1174
+ // htmlCode(states)
1175
+ );
1176
+ }
1177
+
1178
+ onTabChange(text) {
1179
+ this.setState({ codeTabView: text });
1180
+ }
1181
+
1182
+ render() {
1183
+ let { states, descr, renCode, htmlCode, srcReact } = this.props;
1184
+ let { codeView, codeTabView } = this.state;
1185
+ return (
1186
+ <div className="renderPart">
1187
+ <div>
1188
+ <span className="stateName">{states.split("__")[1]}</span>
1189
+ <label className="codeToggle">
1190
+ <input type="checkbox" onClick={this.codePreview} />
1191
+ <div>
1192
+ <div>&lt;/&gt;</div>
1193
+ </div>
1194
+ </label>
1195
+ </div>
1196
+ <div className="renDes">{descr}</div>
1197
+ <div className="renderArea" id={states + "view"}>
1198
+ states
1199
+ </div>
1200
+ <div className={codeView ? "codeView" : "codeArea"}>
1201
+ <div className="borderTab">
1202
+ <div className="codeTabWrap">
1203
+ <span
1204
+ className={codeTabView == "react" ? "activeTabCode" : ""}
1205
+ onClick={this.onTabChange.bind(this, "react")}
1206
+ >
1207
+ React Code
1208
+ </span>
1209
+ <span
1210
+ className={codeTabView == "html" ? "activeTabCode" : ""}
1211
+ onClick={this.onTabChange.bind(this, "html")}
1212
+ >
1213
+ HTML Code
1214
+ </span>
1215
+ </div>
1216
+
1217
+ <div
1218
+ className={
1219
+ codeTabView == "react"
1220
+ ? "reactCode viewsubcode"
1221
+ : "reactCode hidecode"
1222
+ }
1223
+ >
1224
+ {/* <textarea id={states} defaultValue={srcReact} name={states} /> */}
1225
+ </div>
1226
+
1227
+ <div
1228
+ className={
1229
+ codeTabView == "html"
1230
+ ? "htmlCode viewsubcode"
1231
+ : "htmlCode hidecode"
1232
+ }
1233
+ >
1234
+ {/* <textarea id={'html' + states} name={'html' + states} /> */}
1235
+ </div>
1236
+ </div>
1237
+ </div>
1238
+ </div>
1239
+ );
1240
+ }
1241
+ }
1242
+
1243
+ class KeyBoardShortcut extends React.Component {
1244
+ constructor(props) {
1245
+ super(props);
1246
+ this.keyVal = "";
1247
+ this.pressKey = this.pressKey.bind(this);
1248
+ this.toggle = this.toggle.bind(this);
1249
+ this.state = {
1250
+ keyPress: false
1251
+ };
1252
+ }
1253
+ componentDidMount() {
1254
+ // document.addEventListener('keydown', this.pressKey);
1255
+ }
1256
+ toggle() {
1257
+ var clr;
1258
+ clr && clearTimeout(clr);
1259
+ this.setState({ keyPress: true }, () => {
1260
+ clr = setTimeout(() => {
1261
+ this.setState({ keyPress: false });
1262
+ }, 600);
1263
+ });
1264
+ }
1265
+
1266
+ pressKey(e) {
1267
+ var key = e.keyCode;
1268
+ this.keyVal = String.fromCharCode(key);
1269
+ if (e.target.nodeName == "BODY") {
1270
+ switch (key) {
1271
+ case 65:
1272
+ this.toggle();
1273
+ this.props.onSelect("accessibility");
1274
+ break;
1275
+ case 67:
1276
+ this.toggle();
1277
+ this.props.onSelect("components");
1278
+ break;
1279
+ case 68:
1280
+ this.toggle();
1281
+ this.props.onSelect("designTokens");
1282
+ break;
1283
+ case 70:
1284
+ this.toggle();
1285
+ this.props.onSelect("faq");
1286
+ break;
1287
+ case 71:
1288
+ this.toggle();
1289
+ this.props.onSelect("gettingStarted");
1290
+ break;
1291
+ case 73:
1292
+ this.toggle();
1293
+ this.props.onSelect("icons");
1294
+ break;
1295
+ case 85:
1296
+ this.toggle();
1297
+ this.props.onSelect("utilities");
1298
+ break;
1299
+ }
1300
+ }
1301
+ }
1302
+ render() {
1303
+ return (
1304
+ <div className={this.state.keyPress ? "keyBoard" : "hide"}>
1305
+ <span>{this.keyVal}</span>
1306
+ </div>
1307
+ );
1308
+ }
1309
+ }
1310
+
1311
+ ReactDOM.render(<App />, react);