@unbxd-ui/unbxd-react-components 0.2.104 → 0.2.107-beta.2

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 (289) hide show
  1. package/.babelrc +4 -0
  2. package/.eslintrc.js +38 -0
  3. package/CONTRIBUTE.md +105 -0
  4. package/components/Accordian/Accordian.js +45 -13
  5. package/components/Accordian/Accordian.stories.js +25 -6
  6. package/components/Accordian/index.js +3 -0
  7. package/components/Button/Button.js +26 -9
  8. package/components/Button/Button.stories.js +14 -1
  9. package/components/Button/DropdownButton.js +31 -9
  10. package/components/Button/DropdownButton.stories.js +23 -6
  11. package/components/Button/index.js +8 -1
  12. package/components/DataLoader/DataLoader.js +40 -10
  13. package/components/DataLoader/DataLoader.stories.js +30 -5
  14. package/components/DataLoader/index.js +3 -0
  15. package/components/Form/Checkbox.js +42 -14
  16. package/components/Form/DragDropFileUploader.js +42 -12
  17. package/components/Form/Dropdown.js +181 -104
  18. package/components/Form/FileUploader.js +32 -10
  19. package/components/Form/Form.js +45 -15
  20. package/components/Form/FormElementWrapper.js +7 -2
  21. package/components/Form/Input.js +72 -27
  22. package/components/Form/RadioList.js +48 -17
  23. package/components/Form/RangeSlider.js +73 -37
  24. package/components/Form/ServerPaginatedDDList.js +130 -87
  25. package/components/Form/Textarea.js +43 -18
  26. package/components/Form/Toggle.js +48 -16
  27. package/components/Form/index.js +30 -18
  28. package/components/Form/stories/Checkbox.stories.js +12 -1
  29. package/components/Form/stories/DragDropFileUploader.stories.js +8 -0
  30. package/components/Form/stories/Dropdown.stories.js +24 -6
  31. package/components/Form/stories/FileUploader.stories.js +8 -0
  32. package/components/Form/stories/FormDefault.stories.js +21 -1
  33. package/components/Form/stories/RadioList.stories.js +12 -1
  34. package/components/Form/stories/RangeSlider.stories.js +15 -1
  35. package/components/Form/stories/TextInput.stories.js +19 -3
  36. package/components/Form/stories/Textarea.stories.js +12 -1
  37. package/components/Form/stories/Toggle.stories.js +7 -0
  38. package/components/Form/stories/form.stories.js +40 -3
  39. package/components/InlineModal/InlineModal.js +51 -14
  40. package/components/InlineModal/InlineModal.stories.js +14 -2
  41. package/components/InlineModal/index.js +6 -1
  42. package/components/List/List.js +24 -9
  43. package/components/List/index.js +3 -0
  44. package/components/List/list.stories.js +10 -0
  45. package/components/Modal/Modal.js +49 -17
  46. package/components/Modal/Modal.stories.js +15 -1
  47. package/components/Modal/index.js +3 -0
  48. package/components/NotificationComponent/NotificationComponent.js +34 -11
  49. package/components/NotificationComponent/NotificationComponent.stories.js +6 -0
  50. package/components/NotificationComponent/index.js +3 -0
  51. package/components/ProgressBar/ProgressBar.js +11 -2
  52. package/components/ProgressBar/ProgressBar.stories.js +6 -0
  53. package/components/ProgressBar/index.js +3 -0
  54. package/components/Table/BaseTable.js +134 -69
  55. package/components/Table/PaginationComponent.js +23 -11
  56. package/components/Table/Table.js +149 -68
  57. package/components/Table/Table.stories.js +67 -22
  58. package/components/Table/index.js +4 -0
  59. package/components/TabsComponent/TabsComponent.js +57 -20
  60. package/components/TabsComponent/TabsComponent.stories.js +16 -0
  61. package/components/TabsComponent/index.js +3 -0
  62. package/components/Tooltip/Tooltip.js +47 -25
  63. package/components/Tooltip/Tooltip.stories.js +6 -0
  64. package/components/Tooltip/index.js +3 -0
  65. package/components/core.css +1 -3
  66. package/components/index.js +17 -1
  67. package/components/theme.css +0 -2
  68. package/lib/Readme.md +82 -0
  69. package/lib/components/Accordian/Accordian.js +117 -0
  70. package/lib/components/Accordian/Accordian.stories.js +137 -0
  71. package/lib/components/Accordian/index.js +10 -0
  72. package/lib/components/Button/Button.js +84 -0
  73. package/lib/components/Button/Button.stories.js +89 -0
  74. package/lib/components/Button/DropdownButton.js +77 -0
  75. package/lib/components/Button/DropdownButton.stories.js +51 -0
  76. package/lib/components/Button/index.js +32 -0
  77. package/lib/components/DataLoader/DataLoader.js +88 -0
  78. package/lib/components/DataLoader/DataLoader.stories.js +77 -0
  79. package/lib/components/DataLoader/index.js +10 -0
  80. package/lib/components/Form/Checkbox.js +93 -0
  81. package/lib/components/Form/DragDropFileUploader.js +85 -0
  82. package/lib/components/Form/Dropdown.js +478 -0
  83. package/lib/components/Form/FileUploader.js +81 -0
  84. package/lib/components/Form/Form.js +106 -0
  85. package/lib/components/Form/FormElementWrapper.js +27 -0
  86. package/lib/components/Form/Input.js +140 -0
  87. package/lib/components/Form/RadioList.js +111 -0
  88. package/lib/components/Form/RangeSlider.js +142 -0
  89. package/lib/components/Form/ServerPaginatedDDList.js +267 -0
  90. package/lib/components/Form/Textarea.js +95 -0
  91. package/lib/components/Form/Toggle.js +117 -0
  92. package/lib/components/Form/index.js +73 -0
  93. package/lib/components/Form/stories/Checkbox.stories.js +54 -0
  94. package/lib/components/Form/stories/DragDropFileUploader.stories.js +27 -0
  95. package/lib/components/Form/stories/Dropdown.stories.js +114 -0
  96. package/lib/components/Form/stories/FileUploader.stories.js +31 -0
  97. package/lib/components/Form/stories/FormDefault.stories.js +117 -0
  98. package/lib/components/Form/stories/RadioList.stories.js +55 -0
  99. package/lib/components/Form/stories/RangeSlider.stories.js +82 -0
  100. package/lib/components/Form/stories/TextInput.stories.js +79 -0
  101. package/lib/components/Form/stories/Textarea.stories.js +48 -0
  102. package/lib/components/Form/stories/Toggle.stories.js +25 -0
  103. package/lib/components/Form/stories/form.stories.js +240 -0
  104. package/lib/components/InlineModal/InlineModal.js +146 -0
  105. package/lib/components/InlineModal/InlineModal.stories.js +61 -0
  106. package/lib/components/InlineModal/index.js +24 -0
  107. package/lib/components/List/List.js +76 -0
  108. package/lib/components/List/index.js +10 -0
  109. package/lib/components/List/list.stories.js +38 -0
  110. package/lib/components/Modal/Modal.js +117 -0
  111. package/lib/components/Modal/Modal.stories.js +55 -0
  112. package/lib/components/Modal/index.js +10 -0
  113. package/lib/components/NotificationComponent/NotificationComponent.js +76 -0
  114. package/lib/components/NotificationComponent/NotificationComponent.stories.js +29 -0
  115. package/lib/components/NotificationComponent/index.js +10 -0
  116. package/lib/components/ProgressBar/ProgressBar.js +49 -0
  117. package/lib/components/ProgressBar/ProgressBar.stories.js +21 -0
  118. package/lib/components/ProgressBar/index.js +10 -0
  119. package/lib/components/Table/BaseTable.js +352 -0
  120. package/lib/components/Table/PaginationComponent.js +87 -0
  121. package/lib/components/Table/Table.js +333 -0
  122. package/lib/components/Table/Table.stories.js +204 -0
  123. package/lib/components/Table/index.js +17 -0
  124. package/lib/components/TabsComponent/TabsComponent.js +134 -0
  125. package/lib/components/TabsComponent/TabsComponent.stories.js +65 -0
  126. package/lib/components/TabsComponent/index.js +10 -0
  127. package/lib/components/Tooltip/Tooltip.js +102 -0
  128. package/lib/components/Tooltip/Tooltip.stories.js +25 -0
  129. package/lib/components/Tooltip/index.js +10 -0
  130. package/lib/components/core.css +3 -0
  131. package/lib/components/core.scss +29 -0
  132. package/lib/components/index.js +159 -0
  133. package/lib/components/theme.css +3 -0
  134. package/lib/components/theme.scss +11 -0
  135. package/lib/package-lock.json +20607 -0
  136. package/lib/package.json +94 -0
  137. package/package.json +1 -1
  138. package/src/Intro.stories.mdx +119 -0
  139. package/src/components/Accordian/Accordian.js +89 -0
  140. package/src/components/Accordian/Accordian.stories.js +92 -0
  141. package/src/components/Accordian/accordianCore.css +1 -0
  142. package/src/components/Accordian/accordianCore.scss +8 -0
  143. package/src/components/Accordian/accordianTheme.css +1 -0
  144. package/src/components/Accordian/accordianTheme.scss +6 -0
  145. package/src/components/Accordian/index.js +3 -0
  146. package/src/components/Button/Button.js +67 -0
  147. package/src/components/Button/Button.stories.js +103 -0
  148. package/src/components/Button/DropdownButton.js +60 -0
  149. package/src/components/Button/DropdownButton.stories.js +38 -0
  150. package/src/components/Button/button.css +1 -0
  151. package/src/components/Button/buttonTheme.css +1 -0
  152. package/src/components/Button/buttonTheme.scss +45 -0
  153. package/src/components/Button/index.js +5 -0
  154. package/src/components/DataLoader/DataLoader.js +86 -0
  155. package/src/components/DataLoader/DataLoader.stories.js +72 -0
  156. package/src/components/DataLoader/index.js +3 -0
  157. package/src/components/Form/Checkbox.js +73 -0
  158. package/src/components/Form/DragDropFileUploader.js +67 -0
  159. package/src/components/Form/Dropdown.js +430 -0
  160. package/src/components/Form/FileUploader.js +64 -0
  161. package/src/components/Form/Form.js +83 -0
  162. package/src/components/Form/FormElementWrapper.js +22 -0
  163. package/src/components/Form/Input.js +121 -0
  164. package/src/components/Form/RadioList.js +86 -0
  165. package/src/components/Form/RangeSlider.js +100 -0
  166. package/src/components/Form/ServerPaginatedDDList.js +231 -0
  167. package/src/components/Form/Textarea.js +76 -0
  168. package/src/components/Form/Toggle.js +96 -0
  169. package/src/components/Form/form.css +1 -0
  170. package/src/components/Form/formCore.css +1 -0
  171. package/src/components/Form/formCore.scss +142 -0
  172. package/src/components/Form/formTheme.css +1 -0
  173. package/src/components/Form/formTheme.scss +27 -0
  174. package/src/components/Form/index.js +13 -0
  175. package/src/components/Form/stories/Checkbox.stories.js +41 -0
  176. package/src/components/Form/stories/DragDropFileUploader.stories.js +21 -0
  177. package/src/components/Form/stories/Dropdown.stories.js +124 -0
  178. package/src/components/Form/stories/FileUploader.stories.js +21 -0
  179. package/src/components/Form/stories/FormDefault.stories.js +87 -0
  180. package/src/components/Form/stories/RadioList.stories.js +48 -0
  181. package/src/components/Form/stories/RangeSlider.stories.js +84 -0
  182. package/src/components/Form/stories/TextInput.stories.js +77 -0
  183. package/src/components/Form/stories/Textarea.stories.js +43 -0
  184. package/src/components/Form/stories/Toggle.stories.js +14 -0
  185. package/src/components/Form/stories/form.stories.js +216 -0
  186. package/src/components/InlineModal/InlineModal.js +135 -0
  187. package/src/components/InlineModal/InlineModal.stories.js +54 -0
  188. package/src/components/InlineModal/index.js +4 -0
  189. package/src/components/InlineModal/inlineModal.css +1 -0
  190. package/src/components/InlineModal/inlineModalCore.css +1 -0
  191. package/src/components/InlineModal/inlineModalCore.scss +31 -0
  192. package/src/components/InlineModal/inlineModalTheme.css +1 -0
  193. package/src/components/InlineModal/inlineModalTheme.scss +16 -0
  194. package/src/components/List/List.js +72 -0
  195. package/src/components/List/index.js +3 -0
  196. package/src/components/List/list.css +1 -0
  197. package/src/components/List/list.stories.js +28 -0
  198. package/src/components/List/listCore.css +1 -0
  199. package/src/components/List/listCore.scss +6 -0
  200. package/src/components/List/listTheme.css +0 -0
  201. package/src/components/List/listTheme.scss +0 -0
  202. package/src/components/Modal/Modal.js +99 -0
  203. package/src/components/Modal/Modal.stories.js +54 -0
  204. package/src/components/Modal/index.js +3 -0
  205. package/src/components/Modal/modal.css +1 -0
  206. package/src/components/Modal/modalCore.css +1 -0
  207. package/src/components/Modal/modalCore.scss +34 -0
  208. package/src/components/Modal/modalTheme.css +0 -0
  209. package/src/components/Modal/modalTheme.scss +0 -0
  210. package/src/components/NotificationComponent/NotificationComponent.js +58 -0
  211. package/src/components/NotificationComponent/NotificationComponent.stories.js +28 -0
  212. package/src/components/NotificationComponent/index.js +3 -0
  213. package/src/components/NotificationComponent/notificationComponent.css +1 -0
  214. package/src/components/NotificationComponent/notificationTheme.css +1 -0
  215. package/src/components/NotificationComponent/notificationTheme.scss +30 -0
  216. package/src/components/ProgressBar/ProgressBar.js +45 -0
  217. package/src/components/ProgressBar/ProgressBar.stories.js +14 -0
  218. package/src/components/ProgressBar/index.js +3 -0
  219. package/src/components/ProgressBar/progressBar.css +1 -0
  220. package/src/components/ProgressBar/progressBarCore.css +1 -0
  221. package/src/components/ProgressBar/progressBarCore.scss +14 -0
  222. package/src/components/ProgressBar/progressBarTheme.css +0 -0
  223. package/src/components/ProgressBar/progressBarTheme.scss +0 -0
  224. package/src/components/Table/BaseTable.js +306 -0
  225. package/src/components/Table/PaginationComponent.js +73 -0
  226. package/src/components/Table/Table.js +295 -0
  227. package/src/components/Table/Table.stories.js +198 -0
  228. package/src/components/Table/index.js +8 -0
  229. package/src/components/Table/table.css +1 -0
  230. package/src/components/Table/tableCore.css +1 -0
  231. package/src/components/Table/tableCore.scss +94 -0
  232. package/src/components/Table/tableTheme.css +1 -0
  233. package/src/components/Table/tableTheme.scss +34 -0
  234. package/src/components/TabsComponent/TabsComponent.js +99 -0
  235. package/src/components/TabsComponent/TabsComponent.stories.js +69 -0
  236. package/src/components/TabsComponent/index.js +3 -0
  237. package/src/components/TabsComponent/tabs.css +1 -0
  238. package/src/components/TabsComponent/tabsCore.css +1 -0
  239. package/src/components/TabsComponent/tabsCore.scss +59 -0
  240. package/src/components/TabsComponent/tabsTheme.css +0 -0
  241. package/src/components/TabsComponent/tabsTheme.scss +0 -0
  242. package/src/components/Tooltip/Tooltip.js +87 -0
  243. package/src/components/Tooltip/Tooltip.stories.js +16 -0
  244. package/src/components/Tooltip/index.js +3 -0
  245. package/src/components/Tooltip/tooltipCore.css +1 -0
  246. package/src/components/Tooltip/tooltipCore.scss +22 -0
  247. package/src/components/Tooltip/tooltipTheme.css +1 -0
  248. package/src/components/Tooltip/tooltipTheme.scss +21 -0
  249. package/src/components/core.css +1 -0
  250. package/src/components/core.scss +29 -0
  251. package/src/components/index.js +38 -0
  252. package/src/components/theme.css +1 -0
  253. package/src/components/theme.scss +11 -0
  254. package/src/core/Validators.js +34 -0
  255. package/src/core/customHooks.js +20 -0
  256. package/src/core/dataLoader.js +143 -0
  257. package/src/core/dataLoader.stories.js +123 -0
  258. package/src/core/index.js +3 -0
  259. package/src/core/utils.js +95 -0
  260. package/src/index.js +68 -0
  261. package/vscode-templates/NewStoryTemplate.stories.js +8 -0
  262. /package/{Readme.md → README.md} +0 -0
  263. /package/{components → lib/components}/Accordian/accordianCore.css +0 -0
  264. /package/{components → lib/components}/Accordian/accordianTheme.css +0 -0
  265. /package/{components → lib/components}/Button/buttonTheme.css +0 -0
  266. /package/{components → lib/components}/Form/formCore.css +0 -0
  267. /package/{components → lib/components}/Form/formTheme.css +0 -0
  268. /package/{components → lib/components}/InlineModal/inlineModalCore.css +0 -0
  269. /package/{components → lib/components}/InlineModal/inlineModalTheme.css +0 -0
  270. /package/{components → lib/components}/List/listCore.css +0 -0
  271. /package/{components → lib/components}/List/listTheme.css +0 -0
  272. /package/{components → lib/components}/Modal/modalCore.css +0 -0
  273. /package/{components → lib/components}/Modal/modalTheme.css +0 -0
  274. /package/{components → lib/components}/NotificationComponent/notificationTheme.css +0 -0
  275. /package/{components → lib/components}/ProgressBar/progressBarCore.css +0 -0
  276. /package/{components → lib/components}/ProgressBar/progressBarTheme.css +0 -0
  277. /package/{components → lib/components}/Table/tableCore.css +0 -0
  278. /package/{components → lib/components}/Table/tableTheme.css +0 -0
  279. /package/{components → lib/components}/TabsComponent/tabsCore.css +0 -0
  280. /package/{components → lib/components}/TabsComponent/tabsTheme.css +0 -0
  281. /package/{components → lib/components}/Tooltip/tooltipCore.css +0 -0
  282. /package/{components → lib/components}/Tooltip/tooltipTheme.css +0 -0
  283. /package/{core → lib/core}/Validators.js +0 -0
  284. /package/{core → lib/core}/customHooks.js +0 -0
  285. /package/{core → lib/core}/dataLoader.js +0 -0
  286. /package/{core → lib/core}/dataLoader.stories.js +0 -0
  287. /package/{core → lib/core}/index.js +0 -0
  288. /package/{core → lib/core}/utils.js +0 -0
  289. /package/{index.js → lib/index.js} +0 -0
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "@unbxd-ui/unbxd-react-components",
3
+ "version": "0.2.107-beta.1",
4
+ "description": "React components library",
5
+ "keywords": [
6
+ "react components",
7
+ "react library",
8
+ "react components library",
9
+ "react components bundle"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/unbxd/unbxd-react-components.git"
14
+ },
15
+ "author": "Anupama H",
16
+ "license": "ISC",
17
+ "main": "lib/index.js",
18
+ "sideEffects": [
19
+ "*.css"
20
+ ],
21
+ "scripts": {
22
+ "storybook": "start-storybook -p 6006 -s public",
23
+ "deploy-storybook": "storybook-to-ghpages",
24
+ "scss": "node-sass src/components -o src/components --output-style compressed",
25
+ "publish-scss": "node-sass src/components -o lib/components --output-style compressed",
26
+ "postcss": "postcss src/components/*.css --use autoprefixer --dir src/components",
27
+ "publish-postcss": "postcss src/components/*.css --use autoprefixer --dir lib/components",
28
+ "build-css": "npm run scss && npm run postcss",
29
+ "publish-css": "npm run publish-scss && npm run publish-postcss",
30
+ "build": "babel src -d lib",
31
+ "lint": "eslint src",
32
+ "copypackage": "cp -rf package.json Readme.md lib",
33
+ "copyscss": "cp -rf src/components/core.scss src/components/theme.scss lib/components",
34
+ "link": "npm run publish-css && npm run build && npm run copypackage && npm run copyscss && cd lib && npm link",
35
+ "publish": "npm run publish-css && npm run build && npm run copypackage && npm run copyscss && cd lib && npm publish"
36
+ },
37
+ "dependencies": {
38
+ "@storybook/addon-a11y": "^7.0.25",
39
+ "@storybook/addon-storysource": "^7.0.25",
40
+ "bluebird": "^3.7.2",
41
+ "dequal": "^1.0.1",
42
+ "lodash.clonedeep": "^4.5.0",
43
+ "react": "^16.14.0",
44
+ "react-dom": "^16.14.0",
45
+ "react-window": "^1.8.6",
46
+ "react-window-infinite-loader": "^1.0.7",
47
+ "sass": "^1.63.6",
48
+ "whatwg-fetch": "^3.6.2"
49
+ },
50
+ "devDependencies": {
51
+ "@babel/cli": "^7.15.7",
52
+ "@babel/core": "^7.15.8",
53
+ "@babel/plugin-proposal-class-properties": "^7.14.5",
54
+ "@babel/plugin-proposal-export-default-from": "^7.14.5",
55
+ "@babel/preset-env": "^7.15.8",
56
+ "@babel/preset-react": "^7.14.5",
57
+ "@storybook/addon-actions": "^7.0.25",
58
+ "@storybook/addon-console": "^2.0.0",
59
+ "@storybook/addon-docs": "^7.0.26",
60
+ "@storybook/addon-info": "^4.1.8",
61
+ "@storybook/addon-links": "^7.0.25",
62
+ "@storybook/addons": "^7.0.25",
63
+ "@storybook/react": "^7.0.25",
64
+ "@storybook/storybook-deployer": "^2.8.16",
65
+ "autoprefixer": "^10.4.14",
66
+ "babel-eslint": "^10.1.0",
67
+ "babel-loader": "^8.2.3",
68
+ "cross-env": "^7.0.3",
69
+ "css-loader": "^3.6.0",
70
+ "eslint": "^7.2.0",
71
+ "eslint-plugin-babel": "^5.3.1",
72
+ "eslint-plugin-react": "^7.26.1",
73
+ "mini-css-extract-plugin": "^0.8.2",
74
+ "node-sass": "^8.0.0",
75
+ "optimize-css-assets-webpack-plugin": "^6.0.1",
76
+ "postcss-cli": "^10.1.0",
77
+ "sass-loader": "^7.3.1",
78
+ "storybook-readme": "^4.0.5",
79
+ "terser-webpack-plugin": "^1.4.5",
80
+ "webpack": "^4.46.0",
81
+ "webpack-cli": "^3.3.12"
82
+ },
83
+ "overrides": {
84
+ "fbjs": "^3.0.5",
85
+ "marked": "^5.1.0",
86
+ "prismjs": "^1.29.0",
87
+ "glob-parent": "5.1.2",
88
+ "parse-url": "^8.1.0",
89
+ "@jest/transform":"^29.3.1",
90
+ "semver": "^7.3.5"
91
+
92
+ }
93
+ }
94
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unbxd-ui/unbxd-react-components",
3
- "version": "0.2.104",
3
+ "version": "0.2.107-beta.2",
4
4
  "description": "React components library",
5
5
  "keywords": [
6
6
  "react components",
@@ -0,0 +1,119 @@
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
+
3
+ <Meta title="Design System|Introduction" />
4
+
5
+ ## Introduction to the RCB (React Components Bundle) library
6
+
7
+ RCB contains a bunch of low level components (atoms of a design system) that you can use individually
8
+ or combine them to make additional components (molecules of a design system) to build web pages.
9
+
10
+ ## Using the components library
11
+
12
+ First, install the package from npm
13
+
14
+ ```
15
+ npm install react-components-bundle
16
+ ```
17
+
18
+ Next, import the required components. There are 2 ways to achieve this.
19
+
20
+ If you want a minimal footprint from the RCB library and include only the components which you use,
21
+ then import the components individually as shown below.
22
+ This enables tree shaking and therefore components that you did not use will not get included in your final bundle.
23
+
24
+ ```
25
+ import Button from "react-components-bundle/components/Button";
26
+ ```
27
+
28
+ If size of the bundle does not matter or you will use all/most of the components in the RCB library,
29
+ then you can import the components as shown below:
30
+
31
+ ```
32
+ import { Button } from "react-components-bundle";
33
+ ```
34
+
35
+ ### Using core CSS
36
+
37
+ Finally, include the core CSS like below,
38
+
39
+ ```
40
+ import "react-components-bundle/components/core.css";
41
+ ```
42
+
43
+ The core CSS file will contain the core styles without which the component will not behave as expected.
44
+ Hence do not forget to include this.
45
+
46
+ ### Using theme CSS
47
+
48
+ Theme CSS file will contain the styles which suggests a theme for all the components but is not a must have to use the library.
49
+
50
+ You can use the theme CSS in 2 ways:
51
+
52
+ **1. Use individual component CSS**
53
+
54
+ You can import the individual files for each of the components like below:
55
+
56
+ ```
57
+ import "react-components-bundle/components/Table/tableTheme.css";
58
+ ```
59
+
60
+ **2. Include the bundled CSS file which has all component's CSS**
61
+
62
+ You can import the bundled CSS file which contains all the component's CSS like below:
63
+
64
+ ```
65
+ import "react-components-bundle/components/theme.css";
66
+ ```
67
+
68
+ ## Library structure
69
+
70
+ ```
71
+ react-components-bundle
72
+
73
+
74
+ └─── components
75
+ │ │
76
+ │ └─── Button
77
+ │ │
78
+ │ └─── DataLoader
79
+ │ │
80
+ │ └─── Form
81
+ │ │ │
82
+ │ │ └─── Input
83
+ │ │ │
84
+ │ │ └─── Checkbox
85
+ │ │ │
86
+ │ │ └─── DragDropFileUploader
87
+ │ │ │
88
+ │ │ └─── Dropdown
89
+ │ │ │
90
+ │ │ └─── FileUploader
91
+ │ │ │
92
+ │ │ └─── RadioList
93
+ │ │ │
94
+ │ │ └─── RangeSlider
95
+ │ │ │
96
+ │ │ └─── TextArea
97
+ │ │ │
98
+ │ │ └─── Toggle
99
+ │ │
100
+ │ └─── InlineModal
101
+ │ │
102
+ │ └─── List
103
+ │ │
104
+ │ └─── Modal
105
+ │ │
106
+ │ └─── NotificationComponent
107
+ │ │
108
+ │ └─── ProgressBar
109
+ │ │
110
+ │ └─── Table
111
+ │ │
112
+ │ └─── TabsComponent
113
+
114
+ └─── core
115
+
116
+ └─── dataLoader
117
+
118
+ └─── utils
119
+ ```
@@ -0,0 +1,89 @@
1
+ import React, { useState, cloneElement } from "react";
2
+ import PropTypes from "prop-types";
3
+ import List from "../List";
4
+
5
+ const ALL = "ALL";
6
+
7
+ const getDefaultOpenedItems = (items = [], defaultOpen) =>{
8
+ let arr = [];
9
+ if(items.length > 0) {
10
+ items.forEach((item) => {
11
+ const {
12
+ id
13
+ } = item;
14
+ if(id === defaultOpen || defaultOpen === ALL ) {
15
+ arr.push(id)
16
+ }
17
+ })
18
+ }
19
+ return arr;
20
+ }
21
+
22
+ const AccordianItem = (props) => {
23
+ const {
24
+ itemData,
25
+ allowOneOpen,
26
+ openedItems,
27
+ setOpenedItems
28
+ } = props;
29
+ const { titleComponent, bodyComponent, id } = itemData;
30
+ const isOpen = openedItems.find(item => item === id) ? true: false;
31
+ const onItemClick = () => {
32
+ let newList = [id];
33
+ if(!allowOneOpen) {
34
+ newList = isOpen ? openedItems.filter(item => item !== id) : [...openedItems, id]
35
+ }
36
+ setOpenedItems(newList)
37
+ }
38
+ return <li className={`RCB-accordian-item ${isOpen ? "RCB-accordian-open" : "RCB-accordian-close"}`}>
39
+ <div className="RCB-accordian-title" onClick={onItemClick}>{cloneElement(titleComponent, { isOpen: isOpen })}</div>
40
+ {isOpen && <div className="RCB-accordian-body">{bodyComponent}</div>}
41
+ </li>
42
+ };
43
+
44
+ AccordianItem.propTypes = {
45
+ itemData: PropTypes.shape({
46
+ id: PropTypes.string.isRequired,
47
+ titleComponent: PropTypes.element.isRequired,
48
+ bodyComponent: PropTypes.element.isRequired,
49
+ }),
50
+ setOpenedItems: PropTypes.func,
51
+ openedItems: PropTypes.array,
52
+ allowOneOpen: PropTypes.bool
53
+ };
54
+
55
+
56
+ const Accordian = ({defaultOpen, items, allowOneOpen}) => {
57
+ const defaultOpened = getDefaultOpenedItems(items, defaultOpen);
58
+ const [openedItems, setOpenedItems] = useState(defaultOpened);
59
+ return (<div className={`RCB-accordian`}>
60
+ {
61
+ <List
62
+ items={items}
63
+ openedItems={openedItems}
64
+ defaultOpen={defaultOpen}
65
+ allowOneOpen={allowOneOpen}
66
+ setOpenedItems={setOpenedItems}
67
+ ListItem={AccordianItem} />
68
+ }
69
+ </div>);
70
+ };
71
+
72
+ Accordian.propTypes = {
73
+ defaultOpen: PropTypes.string,
74
+ items: PropTypes.arrayOf(PropTypes.shape({
75
+ id: PropTypes.string.isRequired,
76
+ titleComponent: PropTypes.element.isRequired,
77
+ bodyComponent: PropTypes.element.isRequired,
78
+ })).isRequired,
79
+ // /* set to false if you want more than one accordian item to be open at a time */
80
+ allowOneOpen: PropTypes.bool
81
+ };
82
+
83
+ Accordian.defaultProps = {
84
+ allowOneOpen: false,
85
+ defaultOpen:"",//"ALL","ID","",
86
+ items:[]
87
+ };
88
+
89
+ export default Accordian;
@@ -0,0 +1,92 @@
1
+ import React, { Fragment, useState } from "react";
2
+ import Accordian from "./Accordian";
3
+
4
+
5
+ export default {
6
+ title: 'Accordian',
7
+ component: Accordian,
8
+ };
9
+
10
+ const AccordianBody = () => {
11
+ const [count, setRandomNumber] = useState(1);
12
+ const onSetRandom = ()=>{
13
+ setRandomNumber(Math.round(Math.random()*10))
14
+ }
15
+ return <div style={{padding:'20px'}}>
16
+ <h3>This is accordian body</h3>
17
+ <button onClick={onSetRandom}> changed to {count}</button>
18
+ </div>
19
+ }
20
+ const AccordianTitle = ({id}) => {
21
+ return <div>
22
+ {`Title ${id}`}
23
+ </div>
24
+ }
25
+ const Template = (args) => <Accordian {...args} />;
26
+
27
+ export const Default = Template.bind();
28
+ Default.args = {
29
+ items: [{
30
+ id: "41",
31
+ titleComponent: <AccordianTitle id={'41'}/>,
32
+ bodyComponent: <AccordianBody/>,
33
+ }, {
34
+ id: "42",
35
+ titleComponent: <AccordianTitle id={'42'}/>,
36
+ bodyComponent: <AccordianBody/>
37
+ }, {
38
+ id: "43",
39
+ titleComponent: <AccordianTitle id={'43'}/>,
40
+ bodyComponent: <AccordianBody/>
41
+ }, {
42
+ id: "44",
43
+ titleComponent: <AccordianTitle id={'44'}/>,
44
+ bodyComponent: <AccordianBody/>
45
+ }],
46
+ defaultOpen:""
47
+ };
48
+
49
+ export const DefaultOpen = Template.bind();
50
+ DefaultOpen.args = {
51
+ items: [{
52
+ id: "41",
53
+ titleComponent: <AccordianTitle id={'41'}/>,
54
+ bodyComponent: <AccordianBody/>,
55
+ }, {
56
+ id: "42",
57
+ titleComponent: <AccordianTitle id={'42'}/>,
58
+ bodyComponent: <AccordianBody/>
59
+ }, {
60
+ id: "43",
61
+ titleComponent: <AccordianTitle id={'43'}/>,
62
+ bodyComponent: <AccordianBody/>
63
+ }, {
64
+ id: "44",
65
+ titleComponent: <AccordianTitle id={'44'}/>,
66
+ bodyComponent: <AccordianBody/>
67
+ }],
68
+ defaultOpen:"42"
69
+ }
70
+
71
+ export const OpenAtLeastOneAlways = Template.bind();
72
+ OpenAtLeastOneAlways.args = {
73
+ items: [{
74
+ id: "411",
75
+ titleComponent: <AccordianTitle id={'41'}/>,
76
+ bodyComponent: <AccordianBody/>,
77
+ }, {
78
+ id: "421",
79
+ titleComponent: <AccordianTitle id={'42'}/>,
80
+ bodyComponent: <AccordianBody/>
81
+ }, {
82
+ id: "431",
83
+ titleComponent: <AccordianTitle id={'43'}/>,
84
+ bodyComponent: <AccordianBody/>
85
+ }, {
86
+ id: "441",
87
+ titleComponent: <AccordianTitle id={'44'}/>,
88
+ bodyComponent: <AccordianBody/>
89
+ }],
90
+ defaultOpen:"421",
91
+ allowOneOpen:true
92
+ }
@@ -0,0 +1 @@
1
+ .RCB-accordian-title{cursor:pointer}.RCB-list{list-style-type:none}
@@ -0,0 +1,8 @@
1
+ .RCB {
2
+ &-accordian-title {
3
+ cursor: pointer;
4
+ }
5
+ &-list {
6
+ list-style-type: none;
7
+ }
8
+ }
@@ -0,0 +1 @@
1
+ .RCB-accordian-title{padding:10px;border:1px solid #ccc}
@@ -0,0 +1,6 @@
1
+ .RCB {
2
+ &-accordian-title {
3
+ padding: 10px;
4
+ border: 1px solid #ccc;
5
+ }
6
+ }
@@ -0,0 +1,3 @@
1
+ import Accordian from "./Accordian";
2
+
3
+ export default Accordian;
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+
4
+ /** ButtonAppearance enum */
5
+ export const ButtonAppearance = {
6
+ DEFAULT: "default",
7
+ PRIMARY: "primary",
8
+ SECONDARY: "secondary"
9
+ };
10
+ /** ButtonSize enum */
11
+ export const ButtonSize = {
12
+ SMALL: "small",
13
+ MEDIUM: "medium",
14
+ LARGE: "large"
15
+ };
16
+
17
+ /**
18
+ *
19
+ * Displays a Button component
20
+ */
21
+ const Button = (props) => {
22
+ const { children, className, loading, disabled, appearance, size, onClick, ...restProps } = props;
23
+ const btnClassName = `RCB-btn RCB-btn-${appearance} RCB-btn-${size} ${className}` + (loading ? " RCB-btn-loading" : "");
24
+
25
+ return (<button className={btnClassName} disabled={disabled} onClick={onClick} {...restProps}>
26
+ {children}
27
+ </button>);
28
+ };
29
+
30
+ Button.propTypes = {
31
+ /** Add any additional classes to Button component */
32
+ className: PropTypes.string,
33
+ /** Boolean indicating whether the button should render as disabled */
34
+ disabled: PropTypes.bool,
35
+ /** Boolean indicating whether the button is in loading state */
36
+ loading: PropTypes.bool,
37
+ /** String indicating how Button should be rendered.
38
+ * Must be one of,
39
+ * ButtonAppearance = {
40
+ DEFAULT: "default",
41
+ PRIMARY: "primary",
42
+ SECONDARY: "secondary"
43
+ }
44
+ */
45
+ appearance: PropTypes.oneOf(Object.values(ButtonAppearance)),
46
+ /** String indicating the size of the Button
47
+ * Must be one of,
48
+ * ButtonSize = {
49
+ SMALL: "small",
50
+ MEDIUM: "medium",
51
+ LARGE: "large"
52
+ }
53
+ */
54
+ size: PropTypes.oneOf(Object.values(ButtonSize)),
55
+ /** Button onClick handler */
56
+ onClick: PropTypes.func
57
+ };
58
+
59
+ Button.defaultProps = {
60
+ onClick: () => {},
61
+ appearance: ButtonAppearance.DEFAULT,
62
+ size: ButtonSize.SMALL,
63
+ className: ""
64
+ };
65
+
66
+ export default Button;
67
+
@@ -0,0 +1,103 @@
1
+ import React from "react";
2
+ import { action } from "@storybook/addon-actions";
3
+ import Button, { ButtonAppearance, ButtonSize } from "./Button";
4
+
5
+ export const SimpleUsage = () => {
6
+ return (
7
+ <div className="margin-btns">
8
+ <Button size={ButtonSize.SMALL} onClick={action("clicked")}>
9
+ SMALL
10
+ </Button>
11
+ <Button size={ButtonSize.MEDIUM} onClick={action("clicked")}>
12
+ MEDIUM
13
+ </Button>
14
+ <Button size={ButtonSize.LARGE} onClick={action("clicked")}>
15
+ LARGE
16
+ </Button>
17
+ </div>
18
+ );
19
+ };
20
+
21
+ SimpleUsage.story = {
22
+ parameters: {
23
+ docs: {
24
+ storyDescription: "Depicts a simple usage of the button",
25
+ },
26
+ },
27
+ };
28
+
29
+ export const PrimaryButton = () => {
30
+ return (
31
+ <div className="margin-btns">
32
+ <Button
33
+ appearance={ButtonAppearance.PRIMARY}
34
+ size={ButtonSize.SMALL}
35
+ onClick={action("clicked")}
36
+ >
37
+ SMALL
38
+ </Button>
39
+ <Button
40
+ appearance={ButtonAppearance.PRIMARY}
41
+ size={ButtonSize.MEDIUM}
42
+ onClick={action("clicked")}
43
+ >
44
+ MEDIUM
45
+ </Button>
46
+ <Button
47
+ appearance={ButtonAppearance.PRIMARY}
48
+ size={ButtonSize.LARGE}
49
+ onClick={action("clicked")}
50
+ >
51
+ LARGE
52
+ </Button>
53
+ </div>
54
+ );
55
+ };
56
+
57
+ PrimaryButton.story = {
58
+ parameters: {
59
+ docs: {
60
+ storyDescription: "Depicts a primary button",
61
+ },
62
+ },
63
+ };
64
+
65
+ export const SecondaryButton = () => {
66
+ return (
67
+ <div className="margin-btns">
68
+ <Button
69
+ appearance={ButtonAppearance.SECONDARY}
70
+ size={ButtonSize.SMALL}
71
+ onClick={action("clicked")}
72
+ >
73
+ SMALL
74
+ </Button>
75
+ <Button
76
+ appearance={ButtonAppearance.SECONDARY}
77
+ size={ButtonSize.MEDIUM}
78
+ onClick={action("clicked")}
79
+ >
80
+ MEDIUM
81
+ </Button>
82
+ <Button
83
+ appearance={ButtonAppearance.SECONDARY}
84
+ size={ButtonSize.LARGE}
85
+ onClick={action("clicked")}
86
+ >
87
+ LARGE
88
+ </Button>
89
+ </div>
90
+ );
91
+ };
92
+
93
+ SecondaryButton.story = {
94
+ parameters: {
95
+ docs: {
96
+ storyDescription: "Depicts a secondary button",
97
+ },
98
+ },
99
+ };
100
+
101
+ export default {
102
+ title: "Button",
103
+ };
@@ -0,0 +1,60 @@
1
+ import React, { useRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import InlineModal, { InlineModalActivator, InlineModalBody } from "../InlineModal";
4
+ import List from "../List";
5
+
6
+ const DefaultDropdownButtonItem = (props) => {
7
+ let { itemData = {}, onClick } = props;
8
+ let { name } = itemData;
9
+
10
+ const onItemClicked = () => {
11
+ onClick(itemData);
12
+ };
13
+
14
+ return (<li className="RCB-list-item" onClick={onItemClicked}>{name}</li>);
15
+ };
16
+
17
+ DefaultDropdownButtonItem.propTypes = {
18
+ itemData: PropTypes.shape({
19
+ id: PropTypes.string.isRequired,
20
+ name: PropTypes.string.isRequired
21
+ }).isRequired,
22
+ onClick: PropTypes.func.isRequired
23
+ };
24
+
25
+ const DropdownButton = (props) => {
26
+ const { label, options, className, onClick, DropdownButtonItem, ...restProps } = props;
27
+ const modalRef = useRef();
28
+
29
+ const onItemClicked = (itemData) => {
30
+ onClick(itemData);
31
+ modalRef.current.hideModal();
32
+ };
33
+
34
+ return (<InlineModal className={`RCB-dropdown-button ${className}`} ref={modalRef}>
35
+ <InlineModalActivator>{label}</InlineModalActivator>
36
+ <InlineModalBody>
37
+ <List items={options} ListItem={DropdownButtonItem} onClick={onItemClicked} {...restProps} />
38
+ </InlineModalBody>
39
+ </InlineModal>);
40
+ };
41
+
42
+ DropdownButton.propTypes = {
43
+ label: PropTypes.string,
44
+ /** Dropdown items list */
45
+ options: PropTypes.arrayOf(PropTypes.shape({
46
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
47
+ name: PropTypes.string,
48
+ })).isRequired,
49
+ onClick: PropTypes.func.isRequired,
50
+ DropdownButtonItem: PropTypes.any,
51
+ className: PropTypes.string
52
+ };
53
+
54
+ DropdownButton.defaultProps = {
55
+ label: "Select",
56
+ DropdownButtonItem: DefaultDropdownButtonItem,
57
+ className: ""
58
+ };
59
+
60
+ export default DropdownButton;