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

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 (321) hide show
  1. package/README.md +1064 -1061
  2. package/docs/external/active-line.js +72 -72
  3. package/docs/external/autorefresh.js +47 -47
  4. package/docs/external/codemirror.js +9681 -9681
  5. package/docs/external/css/hopscotch.css +576 -576
  6. package/docs/external/css/styleGuide.css +1100 -1100
  7. package/docs/external/css.js +466 -466
  8. package/docs/external/designTokens.js +1 -1
  9. package/docs/external/foldcode.js +151 -151
  10. package/docs/external/format.js +129 -129
  11. package/docs/external/htmlmixed.js +84 -84
  12. package/docs/external/index.html +127 -127
  13. package/docs/external/javascript.js +422 -422
  14. package/docs/external/jsx.js +147 -147
  15. package/docs/external/matchbrackets.js +145 -145
  16. package/docs/external/xml.js +322 -322
  17. package/docs/package.json +41 -41
  18. package/docs/src/index.js +1311 -1311
  19. package/es/AppContainer/AppContainer.module.css +18 -18
  20. package/es/Avatar/Avatar.js +9 -9
  21. package/es/Avatar/Avatar.module.css +117 -117
  22. package/es/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
  23. package/es/AvatarTeam/AvatarTeam.js +7 -7
  24. package/es/AvatarTeam/AvatarTeam.module.css +161 -161
  25. package/es/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
  26. package/es/AvatarTeam/docs/AvatarTeam__custom.docs.js +0 -0
  27. package/es/AvatarTeam/docs/AvatarTeam__default.docs.js +0 -0
  28. package/es/AvatarTeam/docs/AvatarTeam__palette.docs.js +0 -0
  29. package/es/AvatarTeam/docs/AvatarTeam__size.docs.js +0 -0
  30. package/es/Button/Button.js +4 -4
  31. package/es/Button/Button.module.css +521 -521
  32. package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +191 -191
  33. package/es/Button/docs/Button__custom.docs.js +0 -0
  34. package/es/Button/docs/Button__default.docs.js +0 -0
  35. package/es/Buttongroup/Buttongroup.js +1 -1
  36. package/es/Buttongroup/Buttongroup.module.css +89 -89
  37. package/es/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
  38. package/es/Card/Card.js +4 -4
  39. package/es/Card/Card.module.css +20 -20
  40. package/es/Card/docs/Card__Custom.docs.js +0 -0
  41. package/es/Card/docs/Card__Default.docs.js +0 -0
  42. package/es/Card/docs/Card__Scroll.docs.js +0 -0
  43. package/es/CheckBox/CheckBox.js +0 -0
  44. package/es/CheckBox/CheckBox.module.css +157 -153
  45. package/es/CheckBox/docs/CheckBox__custom.docs.js +0 -0
  46. package/es/CheckBox/docs/CheckBox__default.docs.js +0 -0
  47. package/es/DateTime/CalendarView.js +0 -0
  48. package/es/DateTime/DateTime.js +0 -0
  49. package/es/DateTime/DateTime.module.css +187 -187
  50. package/es/DateTime/DateWidget.js +0 -0
  51. package/es/DateTime/DateWidget.module.css +38 -38
  52. package/es/DateTime/YearView.js +0 -0
  53. package/es/DateTime/YearView.module.css +81 -81
  54. package/es/DateTime/common.js +0 -0
  55. package/es/DateTime/docs/DateTime__default.docs.js +0 -0
  56. package/es/DateTime/docs/DateWidget__default.docs.js +0 -0
  57. package/es/DateTime/index.js +0 -0
  58. package/es/DateTime/objectUtils.js +0 -0
  59. package/es/DateTime/typeChecker.js +0 -0
  60. package/es/DateTime/validator.js +0 -0
  61. package/es/DropBox/DropBox.js +0 -0
  62. package/es/DropBox/DropBox.module.css +406 -406
  63. package/es/DropBox/DropBoxPositionMapping.json +144 -144
  64. package/es/DropDown/DropDown.js +0 -0
  65. package/es/DropDown/DropDown.module.css +5 -5
  66. package/es/DropDown/DropDownHeading.js +0 -0
  67. package/es/DropDown/DropDownHeading.module.css +53 -53
  68. package/es/DropDown/DropDownItem.js +0 -0
  69. package/es/DropDown/DropDownItem.module.css +94 -94
  70. package/es/DropDown/DropDownSearch.js +0 -0
  71. package/es/DropDown/DropDownSearch.module.css +14 -14
  72. package/es/DropDown/DropDownSeparator.js +0 -0
  73. package/es/DropDown/DropDownSeparator.module.css +7 -7
  74. package/es/Label/Label.js +2 -2
  75. package/es/Label/Label.module.css +52 -52
  76. package/es/Label/LabelColors.module.css +20 -20
  77. package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
  78. package/es/Label/docs/Label__clipped.docs.js +0 -0
  79. package/es/Label/docs/Label__custom.docs.js +0 -0
  80. package/es/Label/docs/Label__palette.docs.js +0 -0
  81. package/es/Label/docs/Label__size.docs.js +0 -0
  82. package/es/Label/docs/Label__type.docs.js +0 -0
  83. package/es/Layout/Box.js +0 -0
  84. package/es/Layout/Container.js +0 -0
  85. package/es/Layout/Layout.module.css +324 -324
  86. package/es/Layout/docs/Layout__default.docs.js +0 -0
  87. package/es/Layout/utils.js +0 -0
  88. package/es/LightNightMode/Colors.json +496 -496
  89. package/es/ListItem/ListItem.js +0 -0
  90. package/es/ListItem/ListItem.module.css +209 -205
  91. package/es/MultiSelect/AdvancedGroupMultiSelect.js +5 -5
  92. package/es/MultiSelect/MultiSelect.js +5 -5
  93. package/es/MultiSelect/MultiSelect.module.css +205 -205
  94. package/es/MultiSelect/MultiSelectWithAvatar.js +0 -0
  95. package/es/MultiSelect/SelectedOptions.module.css +15 -15
  96. package/es/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
  97. package/es/PopOver/PopOver.module.css +8 -8
  98. package/es/Popup/Popup.js +0 -0
  99. package/es/Popup/PositionMapping.json +73 -73
  100. package/es/Radio/Radio.js +0 -0
  101. package/es/Radio/Radio.module.css +112 -110
  102. package/es/Radio/docs/Radio__custom.docs.js +0 -0
  103. package/es/Radio/docs/Radio__default.docs.js +0 -0
  104. package/es/Responsive/CustomResponsive.js +0 -0
  105. package/es/Responsive/docs/Responsive__Custom.docs.js +0 -0
  106. package/es/Responsive/docs/style.module.css +55 -55
  107. package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
  108. package/es/Ribbon/Ribbon.js +0 -0
  109. package/es/Ribbon/Ribbon.module.css +376 -376
  110. package/es/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
  111. package/es/Ribbon/docs/Ribbon__custom.docs.js +0 -0
  112. package/es/Ribbon/docs/Ribbon__default.docs.js +0 -0
  113. package/es/RippleEffect/RippleEffect.module.css +92 -70
  114. package/es/Select/GroupSelect.js +0 -0
  115. package/es/Select/Select.js +0 -0
  116. package/es/Select/Select.module.css +106 -106
  117. package/es/Select/SelectWithAvatar.js +0 -0
  118. package/es/Select/SelectWithIcon.js +0 -0
  119. package/es/Select/__tests__/Select.spec.js +0 -0
  120. package/es/Select/docs/SelectWithIcon__default.docs.js +0 -0
  121. package/es/Select/docs/Select__default.docs.js +0 -0
  122. package/es/Stencils/Stencils.js +0 -0
  123. package/es/Stencils/Stencils.module.css +96 -96
  124. package/es/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
  125. package/es/Switch/Switch.js +0 -0
  126. package/es/Switch/Switch.module.css +110 -109
  127. package/es/Switch/docs/Switch__custom.docs.js +0 -0
  128. package/es/Switch/docs/Switch__default.docs.js +0 -0
  129. package/es/Tab/Tab.module.css +101 -101
  130. package/es/Tab/TabContent.module.css +4 -4
  131. package/es/Tab/Tabs.js +17 -17
  132. package/es/Tab/Tabs.module.css +141 -141
  133. package/es/Tab/docs/tabdocs.module.css +29 -29
  134. package/es/Tag/Tag.js +8 -8
  135. package/es/Tag/Tag.module.css +254 -254
  136. package/es/Tag/docs/Tag__custom.docs.js +0 -0
  137. package/es/Tag/docs/Tag__default.docs.js +0 -0
  138. package/es/TextBox/TextBox.js +0 -0
  139. package/es/TextBox/TextBox.module.css +157 -157
  140. package/es/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
  141. package/es/TextBox/docs/TextBox__custom.docs.js +0 -0
  142. package/es/TextBox/docs/TextBox__default.docs.js +0 -0
  143. package/es/TextBox/docs/TextBox__variant.docs.js +0 -0
  144. package/es/TextBoxIcon/TextBoxIcon.js +0 -0
  145. package/es/TextBoxIcon/TextBoxIcon.module.css +78 -78
  146. package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
  147. package/es/TextBoxIcon/docs/TextBoxIcon__custom.docs.js +0 -0
  148. package/es/TextBoxIcon/docs/TextBoxIcon__default.docs.js +0 -0
  149. package/es/Textarea/Textarea.js +0 -0
  150. package/es/Textarea/Textarea.module.css +139 -139
  151. package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
  152. package/es/Textarea/docs/Textarea__custom.docs.js +0 -0
  153. package/es/Textarea/docs/Textarea__default.docs.js +0 -0
  154. package/es/Textarea/docs/Textarea__disabled.docs.js +0 -0
  155. package/es/Tooltip/Tooltip.module.css +109 -109
  156. package/es/beta/FocusRing/FocusRing.module.css +151 -151
  157. package/es/common/animation.module.css +624 -624
  158. package/es/common/avatarsizes.module.css +44 -44
  159. package/es/common/basic.module.css +33 -33
  160. package/es/common/basicReset.module.css +40 -40
  161. package/es/common/common.module.css +502 -502
  162. package/es/common/customscroll.module.css +89 -89
  163. package/es/common/docStyle.module.css +766 -766
  164. package/es/common/reset.module.css +12 -12
  165. package/es/common/transition.module.css +146 -146
  166. package/es/deprecated/AdvancedMultiSelect.module.css +126 -126
  167. package/es/semantic/Button/semanticButton.module.css +9 -9
  168. package/es/utils/Common.js +0 -0
  169. package/es/utils/dropDownUtils.js +0 -0
  170. package/lib/AppContainer/AppContainer.module.css +18 -18
  171. package/lib/Avatar/Avatar.js +9 -9
  172. package/lib/Avatar/Avatar.module.css +117 -117
  173. package/lib/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
  174. package/lib/AvatarTeam/AvatarTeam.js +7 -7
  175. package/lib/AvatarTeam/AvatarTeam.module.css +161 -161
  176. package/lib/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
  177. package/lib/AvatarTeam/docs/AvatarTeam__custom.docs.js +0 -0
  178. package/lib/AvatarTeam/docs/AvatarTeam__default.docs.js +0 -0
  179. package/lib/AvatarTeam/docs/AvatarTeam__palette.docs.js +0 -0
  180. package/lib/AvatarTeam/docs/AvatarTeam__size.docs.js +0 -0
  181. package/lib/Button/Button.js +4 -4
  182. package/lib/Button/Button.module.css +521 -521
  183. package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +191 -191
  184. package/lib/Button/docs/Button__custom.docs.js +0 -0
  185. package/lib/Button/docs/Button__default.docs.js +0 -0
  186. package/lib/Buttongroup/Buttongroup.js +1 -1
  187. package/lib/Buttongroup/Buttongroup.module.css +89 -89
  188. package/lib/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
  189. package/lib/Card/Card.js +4 -4
  190. package/lib/Card/Card.module.css +20 -20
  191. package/lib/Card/docs/Card__Custom.docs.js +0 -0
  192. package/lib/Card/docs/Card__Default.docs.js +0 -0
  193. package/lib/Card/docs/Card__Scroll.docs.js +0 -0
  194. package/lib/CheckBox/CheckBox.js +0 -0
  195. package/lib/CheckBox/CheckBox.module.css +157 -153
  196. package/lib/CheckBox/docs/CheckBox__custom.docs.js +0 -0
  197. package/lib/CheckBox/docs/CheckBox__default.docs.js +0 -0
  198. package/lib/DateTime/CalendarView.js +0 -0
  199. package/lib/DateTime/DateTime.js +0 -0
  200. package/lib/DateTime/DateTime.module.css +187 -187
  201. package/lib/DateTime/DateWidget.js +0 -0
  202. package/lib/DateTime/DateWidget.module.css +38 -38
  203. package/lib/DateTime/YearView.js +0 -0
  204. package/lib/DateTime/YearView.module.css +81 -81
  205. package/lib/DateTime/common.js +0 -0
  206. package/lib/DateTime/docs/DateTime__default.docs.js +0 -0
  207. package/lib/DateTime/docs/DateWidget__default.docs.js +0 -0
  208. package/lib/DateTime/index.js +0 -0
  209. package/lib/DateTime/objectUtils.js +0 -0
  210. package/lib/DateTime/typeChecker.js +0 -0
  211. package/lib/DateTime/validator.js +0 -0
  212. package/lib/DropBox/DropBox.js +0 -0
  213. package/lib/DropBox/DropBox.module.css +406 -406
  214. package/lib/DropBox/DropBoxPositionMapping.json +144 -144
  215. package/lib/DropDown/DropDown.js +0 -0
  216. package/lib/DropDown/DropDown.module.css +5 -5
  217. package/lib/DropDown/DropDownHeading.js +0 -0
  218. package/lib/DropDown/DropDownHeading.module.css +53 -53
  219. package/lib/DropDown/DropDownItem.js +0 -0
  220. package/lib/DropDown/DropDownItem.module.css +94 -94
  221. package/lib/DropDown/DropDownSearch.js +0 -0
  222. package/lib/DropDown/DropDownSearch.module.css +14 -14
  223. package/lib/DropDown/DropDownSeparator.js +0 -0
  224. package/lib/DropDown/DropDownSeparator.module.css +7 -7
  225. package/lib/Label/Label.js +0 -0
  226. package/lib/Label/Label.module.css +52 -52
  227. package/lib/Label/LabelColors.module.css +20 -20
  228. package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
  229. package/lib/Label/docs/Label__clipped.docs.js +0 -0
  230. package/lib/Label/docs/Label__custom.docs.js +0 -0
  231. package/lib/Label/docs/Label__palette.docs.js +0 -0
  232. package/lib/Label/docs/Label__size.docs.js +0 -0
  233. package/lib/Label/docs/Label__type.docs.js +0 -0
  234. package/lib/Layout/Box.js +0 -0
  235. package/lib/Layout/Container.js +0 -0
  236. package/lib/Layout/Layout.module.css +324 -324
  237. package/lib/Layout/docs/Layout__default.docs.js +0 -0
  238. package/lib/Layout/utils.js +0 -0
  239. package/lib/LightNightMode/Colors.json +496 -496
  240. package/lib/ListItem/ListItem.js +0 -0
  241. package/lib/ListItem/ListItem.module.css +209 -205
  242. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +5 -5
  243. package/lib/MultiSelect/MultiSelect.js +5 -5
  244. package/lib/MultiSelect/MultiSelect.module.css +205 -205
  245. package/lib/MultiSelect/MultiSelectWithAvatar.js +0 -0
  246. package/lib/MultiSelect/SelectedOptions.module.css +15 -15
  247. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
  248. package/lib/PopOver/PopOver.module.css +8 -8
  249. package/lib/Popup/Popup.js +0 -0
  250. package/lib/Popup/PositionMapping.json +73 -73
  251. package/lib/Radio/Radio.js +0 -0
  252. package/lib/Radio/Radio.module.css +112 -110
  253. package/lib/Radio/docs/Radio__custom.docs.js +0 -0
  254. package/lib/Radio/docs/Radio__default.docs.js +0 -0
  255. package/lib/Responsive/CustomResponsive.js +0 -0
  256. package/lib/Responsive/docs/Responsive__Custom.docs.js +0 -0
  257. package/lib/Responsive/docs/style.module.css +55 -55
  258. package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
  259. package/lib/Ribbon/Ribbon.js +0 -0
  260. package/lib/Ribbon/Ribbon.module.css +376 -376
  261. package/lib/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
  262. package/lib/Ribbon/docs/Ribbon__custom.docs.js +0 -0
  263. package/lib/Ribbon/docs/Ribbon__default.docs.js +0 -0
  264. package/lib/RippleEffect/RippleEffect.module.css +92 -70
  265. package/lib/Select/GroupSelect.js +0 -0
  266. package/lib/Select/Select.js +0 -0
  267. package/lib/Select/Select.module.css +106 -106
  268. package/lib/Select/SelectWithAvatar.js +0 -0
  269. package/lib/Select/SelectWithIcon.js +0 -0
  270. package/lib/Select/__tests__/Select.spec.js +0 -0
  271. package/lib/Select/docs/SelectWithIcon__default.docs.js +0 -0
  272. package/lib/Select/docs/Select__default.docs.js +0 -0
  273. package/lib/Stencils/Stencils.js +0 -0
  274. package/lib/Stencils/Stencils.module.css +96 -96
  275. package/lib/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
  276. package/lib/Switch/Switch.js +0 -0
  277. package/lib/Switch/Switch.module.css +110 -109
  278. package/lib/Switch/docs/Switch__custom.docs.js +0 -0
  279. package/lib/Switch/docs/Switch__default.docs.js +0 -0
  280. package/lib/Tab/Tab.module.css +101 -101
  281. package/lib/Tab/TabContent.module.css +4 -4
  282. package/lib/Tab/Tabs.js +11 -11
  283. package/lib/Tab/Tabs.module.css +141 -141
  284. package/lib/Tab/docs/tabdocs.module.css +29 -29
  285. package/lib/Tag/Tag.js +8 -8
  286. package/lib/Tag/Tag.module.css +254 -254
  287. package/lib/Tag/docs/Tag__custom.docs.js +0 -0
  288. package/lib/Tag/docs/Tag__default.docs.js +0 -0
  289. package/lib/TextBox/TextBox.js +0 -0
  290. package/lib/TextBox/TextBox.module.css +157 -157
  291. package/lib/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
  292. package/lib/TextBox/docs/TextBox__custom.docs.js +0 -0
  293. package/lib/TextBox/docs/TextBox__default.docs.js +0 -0
  294. package/lib/TextBox/docs/TextBox__variant.docs.js +0 -0
  295. package/lib/TextBoxIcon/TextBoxIcon.js +0 -0
  296. package/lib/TextBoxIcon/TextBoxIcon.module.css +78 -78
  297. package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
  298. package/lib/TextBoxIcon/docs/TextBoxIcon__custom.docs.js +0 -0
  299. package/lib/TextBoxIcon/docs/TextBoxIcon__default.docs.js +0 -0
  300. package/lib/Textarea/Textarea.js +0 -0
  301. package/lib/Textarea/Textarea.module.css +139 -139
  302. package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
  303. package/lib/Textarea/docs/Textarea__custom.docs.js +0 -0
  304. package/lib/Textarea/docs/Textarea__default.docs.js +0 -0
  305. package/lib/Textarea/docs/Textarea__disabled.docs.js +0 -0
  306. package/lib/Tooltip/Tooltip.module.css +109 -109
  307. package/lib/beta/FocusRing/FocusRing.module.css +151 -151
  308. package/lib/common/animation.module.css +624 -624
  309. package/lib/common/avatarsizes.module.css +44 -44
  310. package/lib/common/basic.module.css +33 -33
  311. package/lib/common/basicReset.module.css +40 -40
  312. package/lib/common/common.module.css +502 -502
  313. package/lib/common/customscroll.module.css +89 -89
  314. package/lib/common/docStyle.module.css +766 -766
  315. package/lib/common/reset.module.css +12 -12
  316. package/lib/common/transition.module.css +146 -146
  317. package/lib/deprecated/AdvancedMultiSelect.module.css +126 -126
  318. package/lib/semantic/Button/semanticButton.module.css +9 -9
  319. package/lib/utils/Common.js +0 -0
  320. package/lib/utils/dropDownUtils.js +0 -0
  321. package/package.json +74 -74
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);