@zohodesk/components 1.0.0-temp-140 → 1.0.0-temp-142

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 (310) hide show
  1. package/README.md +1190 -1174
  2. package/assets/Appearance/dark/mode/darkMode.module.css +185 -184
  3. package/assets/Appearance/dark/themes/blue/blueDarkCTAModifyCategory.module.css +302 -0
  4. package/assets/Appearance/dark/themes/blue/blueDarkCTATheme.module.css +31 -31
  5. package/assets/Appearance/dark/themes/green/greenDarkCTAModifyCategory.module.css +302 -0
  6. package/assets/Appearance/dark/themes/green/greenDarkCTATheme.module.css +30 -30
  7. package/assets/Appearance/dark/themes/orange/orangeDarkCTAModifyCategory.module.css +302 -0
  8. package/assets/Appearance/dark/themes/orange/orangeDarkCTATheme.module.css +30 -30
  9. package/assets/Appearance/dark/themes/red/redDarkCTAModifyCategory.module.css +302 -0
  10. package/assets/Appearance/dark/themes/red/redDarkCTATheme.module.css +30 -30
  11. package/assets/Appearance/dark/themes/yellow/yellowDarkCTAModifyCategory.module.css +302 -0
  12. package/assets/Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css +30 -30
  13. package/assets/Appearance/default/mode/defaultMode.module.css +181 -180
  14. package/assets/Appearance/default/themes/blue/blueDefaultCTAModifyCategory.module.css +302 -0
  15. package/assets/Appearance/default/themes/blue/blueDefaultCTATheme.module.css +31 -31
  16. package/assets/Appearance/default/themes/green/greenDefaultCTAModifyCategory.module.css +302 -0
  17. package/assets/Appearance/default/themes/green/greenDefaultCTATheme.module.css +30 -30
  18. package/assets/Appearance/default/themes/orange/orangeDefaultCTAModifyCategory.module.css +302 -0
  19. package/assets/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css +30 -30
  20. package/assets/Appearance/default/themes/red/redDefaultCTAModifyCategory.module.css +302 -0
  21. package/assets/Appearance/default/themes/red/redDefaultCTATheme.module.css +30 -30
  22. package/assets/Appearance/default/themes/yellow/yellowDefaultCTAModifyCategory.module.css +302 -0
  23. package/assets/Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css +30 -30
  24. package/assets/Appearance/pureDark/mode/pureDarkMode.module.css +186 -185
  25. package/assets/Appearance/pureDark/themes/blue/bluePureDarkCTAModifyCategory.module.css +302 -0
  26. package/assets/Appearance/pureDark/themes/blue/bluePureDarkCTATheme.module.css +31 -31
  27. package/assets/Appearance/pureDark/themes/green/greenPureDarkCTAModifyCategory.module.css +302 -0
  28. package/assets/Appearance/pureDark/themes/green/greenPureDarkCTATheme.module.css +30 -30
  29. package/assets/Appearance/pureDark/themes/orange/orangePureDarkCTAModifyCategory.module.css +302 -0
  30. package/assets/Appearance/pureDark/themes/orange/orangePureDarkCTATheme.module.css +30 -30
  31. package/assets/Appearance/pureDark/themes/red/redPureDarkCTAModifyCategory.module.css +302 -0
  32. package/assets/Appearance/pureDark/themes/red/redPureDarkCTATheme.module.css +30 -30
  33. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkCTAModifyCategory.module.css +302 -0
  34. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkCTATheme.module.css +30 -30
  35. package/assets/Contrast/darkContrastLightness.module.css +31 -0
  36. package/assets/Contrast/defaultContrastLightness.module.css +31 -0
  37. package/assets/Contrast/pureDarkContrastLightness.module.css +31 -0
  38. package/css_error.log +1 -0
  39. package/es/AppContainer/AppContainer.js +1 -0
  40. package/es/AppContainer/AppContainer.module.css +18 -18
  41. package/es/Avatar/Avatar.js +9 -9
  42. package/es/Avatar/Avatar.module.css +176 -141
  43. package/es/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
  44. package/es/AvatarTeam/AvatarTeam.js +7 -7
  45. package/es/AvatarTeam/AvatarTeam.module.css +188 -188
  46. package/es/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
  47. package/es/Button/Button.js +4 -4
  48. package/es/Button/Button.module.css +543 -525
  49. package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +191 -191
  50. package/es/Buttongroup/Buttongroup.js +1 -1
  51. package/es/Buttongroup/Buttongroup.module.css +107 -89
  52. package/es/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
  53. package/es/Card/Card.js +4 -4
  54. package/es/Card/Card.module.css +20 -20
  55. package/es/CheckBox/CheckBox.js +0 -0
  56. package/es/CheckBox/CheckBox.module.css +157 -157
  57. package/es/DateTime/CalendarView.js +0 -0
  58. package/es/DateTime/DateTime.js +0 -0
  59. package/es/DateTime/DateTime.module.css +235 -235
  60. package/es/DateTime/DateWidget.js +0 -0
  61. package/es/DateTime/DateWidget.module.css +38 -38
  62. package/es/DateTime/YearView.js +0 -0
  63. package/es/DateTime/YearView.module.css +98 -98
  64. package/es/DateTime/common.js +0 -0
  65. package/es/DateTime/index.js +0 -0
  66. package/es/DateTime/objectUtils.js +0 -0
  67. package/es/DateTime/typeChecker.js +0 -0
  68. package/es/DateTime/validator.js +0 -0
  69. package/es/DropBox/DropBox.js +69 -243
  70. package/es/DropBox/DropBoxElement/DropBoxElement.js +118 -0
  71. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +428 -0
  72. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +89 -0
  73. package/es/DropBox/DropBoxElement/props/defaultProps.js +18 -0
  74. package/es/DropBox/DropBoxElement/props/propTypes.js +45 -0
  75. package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +51 -0
  76. package/es/DropBox/DropBoxPositionMapping.json +144 -144
  77. package/es/DropBox/css/DropBox.module.css +59 -0
  78. package/es/DropBox/css/cssJSLogic.js +14 -0
  79. package/es/DropBox/props/defaultProps.js +9 -17
  80. package/es/DropBox/props/propTypes.js +9 -43
  81. package/es/DropDown/DropDown.js +0 -0
  82. package/es/DropDown/DropDown.module.css +5 -5
  83. package/es/DropDown/DropDownHeading.js +0 -0
  84. package/es/DropDown/DropDownHeading.module.css +53 -53
  85. package/es/DropDown/DropDownItem.js +0 -0
  86. package/es/DropDown/DropDownItem.module.css +94 -94
  87. package/es/DropDown/DropDownSearch.js +0 -0
  88. package/es/DropDown/DropDownSearch.module.css +14 -14
  89. package/es/DropDown/DropDownSeparator.js +0 -0
  90. package/es/DropDown/DropDownSeparator.module.css +7 -7
  91. package/es/Heading/Heading.module.css +4 -4
  92. package/es/Label/Label.js +2 -2
  93. package/es/Label/Label.module.css +52 -52
  94. package/es/Label/LabelColors.module.css +20 -20
  95. package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
  96. package/es/Layout/Box.js +0 -0
  97. package/es/Layout/Container.js +0 -0
  98. package/es/Layout/Layout.module.css +335 -335
  99. package/es/Layout/utils.js +0 -0
  100. package/es/ListItem/ListItem.js +0 -0
  101. package/es/ListItem/ListItem.module.css +216 -216
  102. package/es/MultiSelect/AdvancedGroupMultiSelect.js +5 -5
  103. package/es/MultiSelect/MultiSelect.js +5 -5
  104. package/es/MultiSelect/MultiSelect.module.css +205 -205
  105. package/es/MultiSelect/MultiSelectWithAvatar.js +0 -0
  106. package/es/MultiSelect/SelectedOptions.module.css +15 -15
  107. package/es/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
  108. package/es/PopOver/PopOver.module.css +8 -8
  109. package/es/Popup/Popup.js +0 -0
  110. package/es/Popup/PositionMapping.json +73 -73
  111. package/es/Radio/Radio.js +0 -0
  112. package/es/Radio/Radio.module.css +112 -112
  113. package/es/Responsive/CustomResponsive.js +0 -0
  114. package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
  115. package/es/Ribbon/Ribbon.js +0 -0
  116. package/es/Ribbon/Ribbon.module.css +454 -376
  117. package/es/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
  118. package/es/RippleEffect/RippleEffect.module.css +92 -92
  119. package/es/Select/GroupSelect.js +0 -0
  120. package/es/Select/Select.js +0 -0
  121. package/es/Select/Select.module.css +108 -108
  122. package/es/Select/SelectWithAvatar.js +0 -0
  123. package/es/Select/SelectWithIcon.js +0 -0
  124. package/es/Select/__tests__/Select.spec.js +0 -0
  125. package/es/Stencils/Stencils.js +0 -0
  126. package/es/Stencils/Stencils.module.css +96 -96
  127. package/es/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
  128. package/es/Switch/Switch.js +0 -0
  129. package/es/Switch/Switch.module.css +127 -110
  130. package/es/Tab/Tab.module.css +100 -100
  131. package/es/Tab/TabContent.module.css +4 -4
  132. package/es/Tab/Tabs.js +17 -17
  133. package/es/Tab/Tabs.module.css +143 -139
  134. package/es/Tag/Tag.js +8 -8
  135. package/es/Tag/Tag.module.css +254 -254
  136. package/es/TextBox/TextBox.js +0 -0
  137. package/es/TextBox/TextBox.module.css +157 -157
  138. package/es/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
  139. package/es/TextBoxIcon/TextBoxIcon.js +0 -0
  140. package/es/TextBoxIcon/TextBoxIcon.module.css +78 -78
  141. package/es/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
  142. package/es/Textarea/Textarea.js +0 -0
  143. package/es/Textarea/Textarea.module.css +139 -139
  144. package/es/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
  145. package/es/Tooltip/Tooltip.module.css +134 -109
  146. package/es/common/a11y.module.css +3 -3
  147. package/es/common/animation.module.css +624 -624
  148. package/es/common/avatarsizes.module.css +48 -48
  149. package/es/common/basic.module.css +33 -33
  150. package/es/common/basicReset.module.css +40 -40
  151. package/es/common/boxShadow.module.css +34 -0
  152. package/es/common/common.module.css +524 -524
  153. package/es/common/customscroll.module.css +89 -89
  154. package/es/common/reset.module.css +12 -12
  155. package/es/common/transition.module.css +146 -146
  156. package/es/css.js +2 -1
  157. package/es/deprecated/AdvancedMultiSelect.module.css +126 -126
  158. package/es/semantic/Button/semanticButton.module.css +9 -9
  159. package/es/utils/Common.js +0 -0
  160. package/es/utils/css/mergeStyle.js +25 -11
  161. package/es/utils/dropDownUtils.js +0 -0
  162. package/install.md +10 -10
  163. package/lib/AppContainer/AppContainer.js +1 -0
  164. package/lib/AppContainer/AppContainer.module.css +18 -18
  165. package/lib/Avatar/Avatar.js +9 -9
  166. package/lib/Avatar/Avatar.module.css +176 -141
  167. package/lib/Avatar/__tests__/__snapshots__/Avatar.spec.js.snap +288 -288
  168. package/lib/AvatarTeam/AvatarTeam.js +7 -7
  169. package/lib/AvatarTeam/AvatarTeam.module.css +188 -188
  170. package/lib/AvatarTeam/__tests__/__snapshots__/AvatarTeam.spec.js.snap +226 -226
  171. package/lib/Button/Button.js +4 -4
  172. package/lib/Button/Button.module.css +543 -525
  173. package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +191 -191
  174. package/lib/Buttongroup/Buttongroup.js +1 -1
  175. package/lib/Buttongroup/Buttongroup.module.css +107 -89
  176. package/lib/Buttongroup/__test__/__snapshots__/Buttongroup.spec.js.snap +146 -146
  177. package/lib/Card/Card.js +4 -4
  178. package/lib/Card/Card.module.css +20 -20
  179. package/lib/CheckBox/CheckBox.js +0 -0
  180. package/lib/CheckBox/CheckBox.module.css +157 -157
  181. package/lib/DateTime/CalendarView.js +0 -0
  182. package/lib/DateTime/DateTime.js +0 -0
  183. package/lib/DateTime/DateTime.module.css +235 -235
  184. package/lib/DateTime/DateWidget.js +0 -0
  185. package/lib/DateTime/DateWidget.module.css +38 -38
  186. package/lib/DateTime/YearView.js +0 -0
  187. package/lib/DateTime/YearView.module.css +98 -98
  188. package/lib/DateTime/common.js +0 -0
  189. package/lib/DateTime/index.js +0 -0
  190. package/lib/DateTime/objectUtils.js +0 -0
  191. package/lib/DateTime/typeChecker.js +0 -0
  192. package/lib/DateTime/validator.js +0 -0
  193. package/lib/DropBox/DropBox.js +67 -276
  194. package/lib/DropBox/DropBoxElement/DropBoxElement.js +117 -0
  195. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +428 -0
  196. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +72 -0
  197. package/lib/DropBox/DropBoxElement/props/defaultProps.js +25 -0
  198. package/lib/DropBox/DropBoxElement/props/propTypes.js +53 -0
  199. package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +55 -0
  200. package/lib/DropBox/DropBoxPositionMapping.json +144 -144
  201. package/lib/DropBox/css/DropBox.module.css +59 -0
  202. package/lib/DropBox/css/cssJSLogic.js +18 -0
  203. package/lib/DropBox/props/defaultProps.js +15 -19
  204. package/lib/DropBox/props/propTypes.js +15 -45
  205. package/lib/DropDown/DropDown.js +0 -0
  206. package/lib/DropDown/DropDown.module.css +5 -5
  207. package/lib/DropDown/DropDownHeading.js +0 -0
  208. package/lib/DropDown/DropDownHeading.module.css +53 -53
  209. package/lib/DropDown/DropDownItem.js +0 -0
  210. package/lib/DropDown/DropDownItem.module.css +94 -94
  211. package/lib/DropDown/DropDownSearch.js +0 -0
  212. package/lib/DropDown/DropDownSearch.module.css +14 -14
  213. package/lib/DropDown/DropDownSeparator.js +0 -0
  214. package/lib/DropDown/DropDownSeparator.module.css +7 -7
  215. package/lib/Heading/Heading.module.css +4 -4
  216. package/lib/Label/Label.js +0 -0
  217. package/lib/Label/Label.module.css +52 -52
  218. package/lib/Label/LabelColors.module.css +20 -20
  219. package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +101 -101
  220. package/lib/Layout/Box.js +0 -0
  221. package/lib/Layout/Container.js +0 -0
  222. package/lib/Layout/Layout.module.css +335 -335
  223. package/lib/Layout/utils.js +0 -0
  224. package/lib/ListItem/ListItem.js +0 -0
  225. package/lib/ListItem/ListItem.module.css +216 -216
  226. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +5 -5
  227. package/lib/MultiSelect/MultiSelect.js +5 -5
  228. package/lib/MultiSelect/MultiSelect.module.css +205 -205
  229. package/lib/MultiSelect/MultiSelectWithAvatar.js +0 -0
  230. package/lib/MultiSelect/SelectedOptions.module.css +15 -15
  231. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +0 -0
  232. package/lib/PopOver/PopOver.module.css +8 -8
  233. package/lib/Popup/Popup.js +0 -0
  234. package/lib/Popup/PositionMapping.json +73 -73
  235. package/lib/Radio/Radio.js +0 -0
  236. package/lib/Radio/Radio.module.css +112 -112
  237. package/lib/Responsive/CustomResponsive.js +0 -0
  238. package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +6 -6
  239. package/lib/Ribbon/Ribbon.js +0 -0
  240. package/lib/Ribbon/Ribbon.module.css +454 -376
  241. package/lib/Ribbon/__tests__/__snapshots__/Ribbon.spec.js.snap +163 -163
  242. package/lib/RippleEffect/RippleEffect.module.css +92 -92
  243. package/lib/Select/GroupSelect.js +0 -0
  244. package/lib/Select/Select.js +0 -0
  245. package/lib/Select/Select.module.css +108 -108
  246. package/lib/Select/SelectWithAvatar.js +0 -0
  247. package/lib/Select/SelectWithIcon.js +0 -0
  248. package/lib/Select/__tests__/Select.spec.js +0 -0
  249. package/lib/Stencils/Stencils.js +0 -0
  250. package/lib/Stencils/Stencils.module.css +96 -96
  251. package/lib/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +49 -49
  252. package/lib/Switch/Switch.js +0 -0
  253. package/lib/Switch/Switch.module.css +127 -110
  254. package/lib/Tab/Tab.module.css +100 -100
  255. package/lib/Tab/TabContent.module.css +4 -4
  256. package/lib/Tab/Tabs.js +11 -11
  257. package/lib/Tab/Tabs.module.css +143 -139
  258. package/lib/Tag/Tag.js +8 -8
  259. package/lib/Tag/Tag.module.css +254 -254
  260. package/lib/TextBox/TextBox.js +0 -0
  261. package/lib/TextBox/TextBox.module.css +157 -157
  262. package/lib/TextBox/__tests__/__snapshots__/TextBox.spec.js.snap +127 -127
  263. package/lib/TextBoxIcon/TextBoxIcon.js +0 -0
  264. package/lib/TextBoxIcon/TextBoxIcon.module.css +78 -78
  265. package/lib/TextBoxIcon/__tests__/__snapshots__/TextBoxIcon.spec.js.snap +334 -334
  266. package/lib/Textarea/Textarea.js +0 -0
  267. package/lib/Textarea/Textarea.module.css +139 -139
  268. package/lib/Textarea/__tests__/__snapshots__/Textarea.spec.js.snap +97 -97
  269. package/lib/Tooltip/Tooltip.module.css +134 -109
  270. package/lib/common/a11y.module.css +3 -3
  271. package/lib/common/animation.module.css +624 -624
  272. package/lib/common/avatarsizes.module.css +48 -48
  273. package/lib/common/basic.module.css +33 -33
  274. package/lib/common/basicReset.module.css +40 -40
  275. package/lib/common/boxShadow.module.css +34 -0
  276. package/lib/common/common.module.css +524 -524
  277. package/lib/common/customscroll.module.css +89 -89
  278. package/lib/common/reset.module.css +12 -12
  279. package/lib/common/transition.module.css +146 -146
  280. package/lib/css.js +2 -1
  281. package/lib/deprecated/AdvancedMultiSelect.module.css +126 -126
  282. package/lib/semantic/Button/semanticButton.module.css +9 -9
  283. package/lib/utils/Common.js +0 -0
  284. package/lib/utils/css/mergeStyle.js +25 -11
  285. package/lib/utils/dropDownUtils.js +0 -0
  286. package/package.json +103 -103
  287. package/docs/external/active-line.js +0 -72
  288. package/docs/external/autorefresh.js +0 -47
  289. package/docs/external/codemirror.js +0 -9681
  290. package/docs/external/css/hopscotch.css +0 -576
  291. package/docs/external/css/styleGuide.css +0 -1100
  292. package/docs/external/css.js +0 -466
  293. package/docs/external/designTokens.js +0 -1
  294. package/docs/external/foldcode.js +0 -152
  295. package/docs/external/format.js +0 -129
  296. package/docs/external/htmlmixed.js +0 -84
  297. package/docs/external/images/bottom.png +0 -0
  298. package/docs/external/images/bottombg.jpg +0 -0
  299. package/docs/external/images/desk.png +0 -0
  300. package/docs/external/images/desklogo.png +0 -0
  301. package/docs/external/images/menu.png +0 -0
  302. package/docs/external/index.html +0 -127
  303. package/docs/external/javascript.js +0 -422
  304. package/docs/external/jsx.js +0 -148
  305. package/docs/external/matchbrackets.js +0 -145
  306. package/docs/external/xml.js +0 -322
  307. package/docs/package.json +0 -41
  308. package/docs/src/index.js +0 -1311
  309. package/es/DropBox/DropBox.module.css +0 -405
  310. package/lib/DropBox/DropBox.module.css +0 -405
package/docs/src/index.js DELETED
@@ -1,1311 +0,0 @@
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);