@unbxd-ui/unbxd-react-components 0.2.105 → 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 -86
  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,3 @@
1
+ import Tooltip from "./Tooltip";
2
+
3
+ export default Tooltip;
@@ -0,0 +1 @@
1
+ .RCB-tooltip{display:inline-block;position:relative}.RCB-tooltip .RCB-tooltip-body.RCB-tooltip-hover{display:inline-block}.RCB-tooltip .RCB-tooltip-body.RCB-tooltip-click{display:inline-block}.RCB-tooltip-body{display:none;position:absolute;z-index:1}
@@ -0,0 +1,22 @@
1
+ .RCB {
2
+ &-tooltip {
3
+ display: inline-block;
4
+ position: relative;
5
+
6
+ .RCB-tooltip-body {
7
+ &.RCB-tooltip-hover {
8
+ display: inline-block;
9
+ }
10
+
11
+ &.RCB-tooltip-click {
12
+ display: inline-block;
13
+ }
14
+ }
15
+ }
16
+
17
+ &-tooltip-body {
18
+ display: none;
19
+ position: absolute;
20
+ z-index: 1;
21
+ }
22
+ }
@@ -0,0 +1 @@
1
+ .RCB-tooltip-btn{display:inline-block;font-style:italic;font-size:12px;color:#9199AA;background-color:#F8FAFB;border:1px solid #D0DDE2;padding:0px 6px;border-radius:50%;text-align:center}.RCB-tooltip-body{background:#FFF;padding:10px;border-radius:4px;box-shadow:0px 1px 7px 0px #ccc;margin-left:15px}
@@ -0,0 +1,21 @@
1
+ .RCB {
2
+ &-tooltip-btn {
3
+ display: inline-block;
4
+ font-style: italic;
5
+ font-size: 12px;
6
+ color: #9199AA;
7
+ background-color: #F8FAFB;
8
+ border: 1px solid #D0DDE2;
9
+ padding: 0px 6px;
10
+ border-radius: 50%;
11
+ text-align: center;
12
+ }
13
+
14
+ &-tooltip-body {
15
+ background: #FFF;
16
+ padding: 10px;
17
+ border-radius: 4px;
18
+ box-shadow: 0px 1px 7px 0px #ccc;
19
+ margin-left: 15px;
20
+ }
21
+ }
@@ -0,0 +1 @@
1
+ .RCB-form-el-inline{margin:20px 0;display:inline-block}.RCB-form-el-inline .RCB-form-el-label{margin-right:15px}.RCB-form-el-inline .RCB-toggle{display:inline-block}.RCB-form-el-block{margin:20px 0}.RCB-form-el-block .RCB-form-el-label{display:block}.RCB-dropdown .RCB-list-item{list-style-type:none;padding:10px;cursor:pointer}.RCB-dropdown .RCB-list-item:hover{background-color:#eee}.RCB-dropdown .RCB-list-item.selected{background-color:#eee}.RCB-dd-with-create .RCB-inline-modal-body{display:flex;flex-direction:column}.RCB-dd-with-create .RCB-inline-modal-body .RCB-list{flex:1;overflow:scroll}.RCB-dd-with-create .RCB-dd-create-cta{padding:10px;text-align:center;border:1px solid #bfbfbf;cursor:pointer}.RCB-clear-selected{background:#f2f0f0;padding:3px 6px;font-size:11px;border-radius:15px;border:1px solid #ccc}.RCB-selection-wrapper{float:right}.RCB-selection-wrapper .RCB-select-arrow{float:unset}.RCB-select-arrow{float:right;font-size:12px;color:#96a9bc;margin-right:12px;margin-left:8px}.RCB-select-arrow:after{content:"\25BC";vertical-align:middle}.RCB-dd-label{display:inline-block;overflow:hidden;text-overflow:ellipsis;max-width:70%;vertical-align:top;white-space:nowrap}.RCB-file-input{cursor:pointer}.RCB-drag-drop-uploader{border:2px dashed rgba(104,128,145,0.42);padding:20px;text-align:center}.RCB-drag-over{background:#f3f3f3}.RCB-toggle{padding:2px 3px;background-color:#FFF;border:1px solid #CCC;border-radius:20px;box-sizing:content-box;cursor:pointer}.RCB-toggle.active{background-color:#2cb191}.RCB-toggle.active .RCB-toggle-knob{background-color:#FFF}.RCB-toggle-disable{cursor:not-allowed;opacity:0.8}.RCB-toggle-knob{background-color:#8399ae;border-radius:50%;-webkit-transition:transform .3s ease;-moz-transition:transform .3s ease;-ms-transition:transform .3s ease;transition:transform .3s ease}.RCB-modal{position:fixed;top:0;width:100%;height:100%;background:rgba(0,0,0,0.8);display:flex;justify-content:center;align-items:center;z-index:2}.RCB-modal-body{background:#FFF;padding:20px}.RCB-modal-header{display:flex;margin-bottom:10px}.RCB-modal-title{flex:1}.RCB-modal-close{cursor:pointer}.RCB-modal-close:before{content:"X"}.RCB-inline-modal{position:relative;display:inline-block}.RCB-inline-modal.hover-open .RCB-inline-modal-body{display:none}.RCB-inline-modal.hover-open:hover .RCB-inline-modal-body{display:block}.RCB-inline-modal-body{position:absolute;z-index:1}.RCB-inline-modal-body.RCB-align-left{left:0}.RCB-inline-modal-body.RCB-align-right{right:0}.RCB-list{margin:0;padding:0}.RCB-table{border-collapse:collapse;width:100%}.RCB-th.RCB-expand-column{width:50px}.RCB-th-sortable{cursor:pointer}.RCB-th-sort:after{content:"\2B0D"}.RCB-th-asc:after{content:"\25B2"}.RCB-th-dsc:after{content:"\25BC"}.RCB-tr .expand-open:before{content:"▼"}.RCB-tr .expand-close:before{content:"▶"}.RCB-paginate-wrapper .RCB-per-page-count{display:inline-block}.RCB-paginate-wrapper .RCB-form-el-cont{margin:0}.RCB-paginate-wrapper .RCB-inline-modal-btn{background:transparent;padding:0}.RCB-paginate-nav{display:inline-block;border-radius:12px;border:solid 1px #8399ae;background-color:#f6f7f9;vertical-align:middle;margin-left:15px;overflow:hidden}.RCB-page-nav{padding:0 5px;text-decoration:none;color:inherit}.RCB-page-nav:first-child{border-right:solid 1px #8399ae}.RCB-page-nav.disabled{color:#ccc;pointer-events:none;cursor:not-allowed}.RCB-no-data{text-align:center}.RCB-tabs-container{display:flex}.RCB-tab-title{list-style-type:none;padding:10px;cursor:pointer}.RCB-tab-title.selected{background:#FFF;font-weight:bold;border:1px solid #cacaca;position:relative;z-index:1}.RCB-tabs-horizontal{flex-direction:column}.RCB-tabs-horizontal .RCB-tab-title{display:inline-block}.RCB-tabs-horizontal .RCB-tab-title.selected{border-bottom:0;bottom:-1px}.RCB-tabs-vertical .RCB-tab-title{display:block}.RCB-tabs-vertical .RCB-tab-title.selected{border-right:0;right:-1px}.RCB-tab-content{list-style-type:none;border:1px solid #cacaca;padding:10px}.RCB-tab-content.selected{display:block}.RCB-tab-disabled{pointer-events:none;cursor:not-allowed;color:#ccc}.RCB-progress-bar{width:100%;position:relative;background:#ccc}.RCB-progress-value{height:100%;position:absolute;top:0;background:#3d9565}.RCB-tooltip{display:inline-block;position:relative}.RCB-tooltip .RCB-tooltip-body.RCB-tooltip-hover{display:inline-block}.RCB-tooltip .RCB-tooltip-body.RCB-tooltip-click{display:inline-block}.RCB-tooltip-body{display:none;position:absolute;z-index:1}.RCB-accordian-title{cursor:pointer}.RCB-list{list-style-type:none}.RCB-hidden{display:none}.RCB-no-pointer{pointer-events:none}.RCB-disabled .RCB-inline-modal-btn{cursor:not-allowed;pointer-events:none}
@@ -0,0 +1,29 @@
1
+ /**
2
+ Add all the styles here without which the component behaviour would be meaningless
3
+ & hence these styles are must haves for anyone using the component
4
+ **/
5
+
6
+ @import "./Form/formCore.scss";
7
+ @import "./Modal/modalCore.scss";
8
+ @import "./InlineModal/inlineModalCore.scss";
9
+ @import "./List/listCore.scss";
10
+ @import "./Table/tableCore.scss";
11
+ @import "./TabsComponent/tabsCore.scss";
12
+ @import "./ProgressBar/progressBarCore.scss";
13
+ @import "./Tooltip/tooltipCore.scss";
14
+ @import "./Accordian/accordianCore.scss";
15
+
16
+ .RCB-hidden {
17
+ display: none;
18
+ }
19
+
20
+ .RCB-no-pointer {
21
+ pointer-events: none;
22
+ }
23
+
24
+ .RCB-disabled {
25
+ .RCB-inline-modal-btn {
26
+ cursor: not-allowed;
27
+ pointer-events: none;
28
+ }
29
+ }
@@ -0,0 +1,38 @@
1
+ import Button, { DropdownButton } from "./Button";
2
+ import List from "./List";
3
+ import Modal from "./Modal";
4
+ import InlineModal from "./InlineModal";
5
+ import DataLoader from "./DataLoader";
6
+ import Form, { Input, Textarea, Checkbox, RadioList, Dropdown, RangeSlider, FileUploader, DragDropFileUploader, Toggle } from "./Form";
7
+ import Table , { PaginationComponent } from "./Table";
8
+ import TabsComponent from "./TabsComponent";
9
+ import NotificationComponent from "./NotificationComponent";
10
+ import ProgressBar from "./ProgressBar";
11
+ import Tooltip from "./Tooltip";
12
+ import Accordian from "./Accordian";
13
+
14
+ export {
15
+ Button,
16
+ DropdownButton,
17
+ List,
18
+ Modal,
19
+ InlineModal,
20
+ DataLoader,
21
+ Form,
22
+ Input,
23
+ Textarea,
24
+ Checkbox,
25
+ RadioList,
26
+ Dropdown,
27
+ RangeSlider,
28
+ FileUploader,
29
+ DragDropFileUploader,
30
+ Toggle,
31
+ Table,
32
+ PaginationComponent,
33
+ TabsComponent,
34
+ NotificationComponent,
35
+ ProgressBar,
36
+ Tooltip,
37
+ Accordian
38
+ };
@@ -0,0 +1 @@
1
+ .RCB-btn{border-radius:3px;cursor:pointer}.RCB-btn-default:hover{background:#f3f3f3}.RCB-btn-primary{background:#1fa7fd;color:#FFF;border:0}.RCB-btn-primary:hover{background:#208dd2}.RCB-btn-secondary{background:#FFF;border:1px solid #95c7e7}.RCB-btn-secondary:hover{background:#eef8ff}.RCB-btn-small{padding:6px 8px}.RCB-btn-medium{padding:10px 15px}.RCB-btn-large{padding:15px 22px}.RCB-form-error{font-size:12px;color:#d25b5b}.RCB-dd-search{position:relative}.RCB-dd-search-icon{position:absolute;top:5px;left:10px}.RCB-dd-search-icon:before{content:"\1F50D"}.RCB-dd-search-ip{width:100%;padding:10px 30px;border:none;border-bottom:1px solid #CCC}.RCB-inline-modal-btn{display:inline-block;background:#FFF;border:1px solid #eee;padding:10px;border-radius:3px;cursor:pointer}.RCB-inline-modal-body{background:#FFF;border:1px solid #efeeee;box-shadow:0 9px 12px 0 rgba(0,0,0,0.15)}.RCB-notif{padding:10px;border-radius:3px}.RCB-notif-success{color:#129274;border:solid 1px #2cb191;background-color:#edfffb}.RCB-notif-error{color:#d25b5b;border:solid 1px #e75178;background-color:#fff3f6}.RCB-notif-warning{color:#445870;border:solid 1px #efbf6a;background-color:#fffaf2}.RCB-notif-info{color:#509DB9;border:solid 1px #45b5c1;background-color:#f4fcff}.RCB-table td{padding:10px}.RCB-th{background-color:#2287b4;color:#FFF;font-weight:normal;padding:10px}.RCB-even-tr{background-color:#FFF}.RCB-odd-tr{background-color:#dcf1fa}.RCB-expanded-row{background-color:#ecf2f4}.RCB-paginate-bar{background-color:#a3c9db;text-align:right;font-size:14px;padding:5px;border-radius:5px 5px 0 0}.RCB-tooltip-btn{display:inline-block;font-style:italic;font-size:12px;color:#9199AA;background-color:#F8FAFB;border:1px solid #D0DDE2;padding:0px 6px;border-radius:50%;text-align:center}.RCB-tooltip-body{background:#FFF;padding:10px;border-radius:4px;box-shadow:0px 1px 7px 0px #ccc;margin-left:15px}.RCB-accordian-title{padding:10px;border:1px solid #ccc}
@@ -0,0 +1,11 @@
1
+ /**
2
+ Add all the styles here which suggests a theme for the component but is not a must have to use the component
3
+ **/
4
+
5
+ @import "./Button/buttonTheme.scss";
6
+ @import "./Form/formTheme.scss";
7
+ @import "./InlineModal/inlineModalTheme.scss";
8
+ @import "./NotificationComponent/notificationTheme.scss";
9
+ @import "./Table/tableTheme.scss";
10
+ @import "./Tooltip/tooltipTheme.scss";
11
+ @import "./Accordian/accordianTheme.scss";
@@ -0,0 +1,34 @@
1
+ import utils from "./utils";
2
+
3
+ const VALIDATORS = {
4
+ EMAIL: (value = "") => {
5
+ const regEx = /^[_A-Za-z0-9-+]+(\.[_A-Za-z0-9-\\+]+)*@[_A-Za-z0-9-+]+(\.[_A-Za-z0-9-+]+)*(\.[A-Za-z]{2,})$/i;
6
+ return regEx.test(value.trim());
7
+ },
8
+ NUMERIC: (value = "") => {
9
+ const regEx = /^\d+$/;
10
+ const numValue = +value;
11
+ return regEx.test(numValue);
12
+ },
13
+ ALPHA_NUMERIC: (value = "") => {
14
+ const regEx = /^[A-Za-z0-9]+$/;
15
+ return regEx.test(value.trim());
16
+ },
17
+ URL: (value = "") => {
18
+ const regEx = /^(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?$/i;
19
+ return regEx.test(value.trim());
20
+ },
21
+ REQUIRED: (value) => {
22
+ if ((utils.isArray(value) && value.length == 0)
23
+ || (value !== 0 && !value)) {
24
+ return false;
25
+ }
26
+ return true;
27
+ },
28
+ CUSTOM: (value, validationObj) => {
29
+ const { validator = () => {} } = validationObj;
30
+ return validator.call(null, value, validationObj);
31
+ }
32
+ };
33
+
34
+ export default VALIDATORS;
@@ -0,0 +1,20 @@
1
+ import { useState, useEffect, useRef, useCallback } from "react";
2
+
3
+ export function useDidUpdateEffect(fn, inputs) {
4
+ const didMountRef = useRef(false);
5
+
6
+ useEffect(() => {
7
+ if (didMountRef.current)
8
+ fn();
9
+ else
10
+ didMountRef.current = true;
11
+ }, inputs);
12
+ }
13
+
14
+ export function useForceUpdate() {
15
+ const [, setTick] = useState(0);
16
+ const update = useCallback(() => {
17
+ setTick(tick => tick + 1);
18
+ }, []);
19
+ return update;
20
+ }
@@ -0,0 +1,143 @@
1
+ import { Promise } from "bluebird";
2
+ import { fetch as fetchPolyfill } from "whatwg-fetch";
3
+ import utils from "./utils";
4
+
5
+ const UNAUTHORIZED = 401,
6
+ NOT_FOUND = 404;
7
+
8
+ class DataLoader {
9
+ _requestsMap = {}
10
+ _commonHeaders = {}
11
+ _responseParser = x => x
12
+ _requestParser = x => x
13
+ _exceptionHandler = x => x
14
+ _middlewares = {}
15
+ setCommonHeaders (headers) {
16
+ this._commonHeaders = {...this._commonHeaders, ...headers};
17
+ }
18
+ setResponseParser (responseParser) {
19
+ this._responseParser = responseParser;
20
+ }
21
+ setRequestParser (requestParser) {
22
+ this._requestParser = requestParser;
23
+ }
24
+ setExceptionHandler (exceptionHandler) {
25
+ this._exceptionHandler = exceptionHandler;
26
+ }
27
+ addRequestConfig (requestId, requestConfig) {
28
+ this._requestsMap[requestId] = requestConfig;
29
+ }
30
+ getRequestMiddleware (requestId) {
31
+ let requestMiddleware = x => x,
32
+ middleware = this._middlewares[requestId];
33
+
34
+ if (typeof(middleware) !== "undefined" && typeof(middleware.reqParser) === "function") {
35
+ requestMiddleware = middleware.reqParser;
36
+ }
37
+
38
+ return requestMiddleware;
39
+ }
40
+ getResponseMiddleware (requestId) {
41
+ let responseMiddleware = x => x,
42
+ middleware = this._middlewares[requestId];
43
+
44
+ if (typeof(middleware) !== "undefined" && typeof(middleware.resParser) === "function") {
45
+ responseMiddleware = middleware.resParser;
46
+ }
47
+
48
+ return responseMiddleware;
49
+ }
50
+ getRequestParams (requestId, params) {
51
+ const requestParser = this.getRequestMiddleware(requestId);
52
+ return requestParser(params, requestId);
53
+ }
54
+ parseResponseData (requestId, response, headers, status) {
55
+ const responseParser = this.getResponseMiddleware(requestId);
56
+ const commonParser = this._responseParser;
57
+ /* parse through common parser */
58
+ response = typeof(commonParser) === "function" ? commonParser(response, requestId, headers, status) : response;
59
+ return responseParser(response, requestId, headers, status);
60
+ }
61
+ getRequestDef ({ requestId, urlParams = {}, params = {}, headers = {} }) {
62
+ const requestConfig = this._requestsMap[requestId];
63
+ const { url, method = "GET" } = requestConfig;
64
+ const finalRequestParams = this.getRequestParams(requestId, params);
65
+
66
+ let requestUrl = (typeof(url) === "function") ? url(urlParams) : url;
67
+ let reqMethod = method.toLowerCase();
68
+
69
+ let requestMetadata = {
70
+ method: (reqMethod === "form_post" || reqMethod === "upload") ? "post" : method,
71
+ headers: {...this._commonHeaders, ...headers}
72
+ };
73
+
74
+ const requestHeaders = requestMetadata.headers;
75
+
76
+ for (let header in requestHeaders) {
77
+ if (requestHeaders[header] === null) {
78
+ /* if header is set as null, delete it from the headers list */
79
+ delete requestHeaders[header];
80
+ }
81
+ }
82
+
83
+ if (reqMethod === "get") {
84
+ requestUrl = `${requestUrl}?${utils.getQueryParams(finalRequestParams)}`;
85
+ } else if (["post", "delete", "put", "patch"].indexOf(reqMethod) > -1) {
86
+ requestMetadata.body = JSON.stringify(finalRequestParams);
87
+ } else if (reqMethod === "form_post" || reqMethod === "upload") {
88
+ const formData = new FormData();
89
+ for (const key in finalRequestParams) {
90
+ formData.append(key, finalRequestParams[key]);
91
+ }
92
+ requestMetadata.body = formData;
93
+ delete requestHeaders["Content-Type"];
94
+ }
95
+
96
+ return new Promise((resolve, reject) => {
97
+ return fetchPolyfill(requestUrl, requestMetadata)
98
+ .then(response => {
99
+ const { status, statusText, headers } = response;
100
+
101
+ if (status === UNAUTHORIZED || status === NOT_FOUND) {
102
+ this._exceptionHandler(response);
103
+ reject(response);
104
+ } else {
105
+ const stringStatus = status.toString();
106
+ if (stringStatus.indexOf("2") === 0 || stringStatus.indexOf("4") === 0) {
107
+ /* Success : 2** response code, or 4** response code */
108
+ return response.json().then((data) => {
109
+ return {
110
+ headers: headers,
111
+ status: status,
112
+ json: data
113
+ }
114
+ })
115
+ } else {
116
+ this._exceptionHandler(statusText);
117
+ reject(statusText);
118
+ }
119
+ }
120
+ })
121
+ .then(({headers, json, status}) => {
122
+ const parsedResponse = this.parseResponseData(requestId, json, headers, status);
123
+ resolve(parsedResponse);
124
+ })
125
+ .catch(exception => {
126
+ this._exceptionHandler(exception);
127
+ reject(exception);
128
+ });
129
+ });
130
+ }
131
+ addMiddleware (requestId, { requestParser, responseParser }) {
132
+ if (typeof(this._middlewares[requestId]) !== "undefined") {
133
+ throw new Error(`Middleware for ${requestId} already exists`);
134
+ }
135
+
136
+ this._middlewares[requestId] = {
137
+ reqParser: requestParser,
138
+ resParser: responseParser
139
+ };
140
+ }
141
+ }
142
+
143
+ export default new DataLoader();
@@ -0,0 +1,123 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import dataLoader from "./dataLoader";
3
+ import List from "../components/List";
4
+
5
+ dataLoader.addRequestConfig("getUsers", {
6
+ method: "GET",
7
+ url: "https://jsonplaceholder.typicode.com/users",
8
+ });
9
+
10
+ dataLoader.addRequestConfig("getTodo", {
11
+ method: "GET",
12
+ url: function(params) {
13
+ return `https://jsonplaceholder.typicode.com/todos/${params.todoId}`
14
+ }
15
+ });
16
+
17
+ dataLoader.addRequestConfig("getPost", {
18
+ method: "GET",
19
+ url: function(params) {
20
+ return `https://jsonplaceholder.typicode.com/posts/${params.id}`
21
+ }
22
+ });
23
+
24
+ export const SimpleUsage = () => {
25
+ const [ data, setData ] = useState([]);
26
+
27
+ useEffect(() => {
28
+ const def = dataLoader.getRequestDef({
29
+ requestId: "getUsers"
30
+ });
31
+
32
+ def.done((response) => {
33
+ setData(response);
34
+ });
35
+
36
+ def.catch((e) => {
37
+ console.error(e);
38
+ });
39
+ }, []);
40
+
41
+ return (<div>
42
+ <p>Use the <code>dataLoader</code> instance to make explicit API calls.
43
+ This would mostly be required for create/update/delete calls like POST, PUT, PATCH or DELETE</p>
44
+ {(data && data.length > 0) && <List items={data} />}
45
+ </div>);
46
+ };
47
+
48
+ export const RequestMiddleware = () => {
49
+ const [ data, setData ] = useState([]);
50
+ const { title } = data;
51
+
52
+ useEffect(() => {
53
+ dataLoader.addMiddleware("getTodo", {
54
+ requestParser: function(requestId, params) {
55
+ return {
56
+ todoId: params.id
57
+ };
58
+ }
59
+ });
60
+
61
+ const def = dataLoader.getRequestDef({
62
+ requestId: "getTodo",
63
+ params: {
64
+ id: 1
65
+ },
66
+ urlParams: {
67
+ todoId: 1
68
+ }
69
+ });
70
+
71
+ def.done((response) => {
72
+ setData(response);
73
+ });
74
+
75
+ def.catch((e) => {
76
+ console.error(e);
77
+ });
78
+ }, []);
79
+
80
+ return (<div>
81
+ <p>Use the <code>addMiddleware</code> functionality to add request middleware code to parse/modify the request data before sending it to the API.</p>
82
+ <div>Todo name is {title}</div>
83
+ </div>);
84
+ };
85
+
86
+ export const ResponseMiddleware = () => {
87
+ const [ data, setData ] = useState([]);
88
+ const { postName } = data;
89
+
90
+ useEffect(() => {
91
+ dataLoader.addMiddleware("getPost", {
92
+ responseParser: function(requestId, response) {
93
+ return {
94
+ postName: response.title
95
+ };
96
+ }
97
+ });
98
+
99
+ const def = dataLoader.getRequestDef({
100
+ requestId: "getPost",
101
+ urlParams: {
102
+ id: 1
103
+ }
104
+ });
105
+
106
+ def.done((response) => {
107
+ setData(response);
108
+ });
109
+
110
+ def.catch((e) => {
111
+ console.error(e);
112
+ });
113
+ }, []);
114
+
115
+ return (<div>
116
+ <p>Use the <code>addMiddleware</code> functionality to add response middleware code to parse/modify the response data before using it in the component</p>
117
+ <div>Post name is {postName}</div>
118
+ </div>);
119
+ };
120
+
121
+ export default {
122
+ title: "Data fetching|dataLoader (instance)"
123
+ };
@@ -0,0 +1,3 @@
1
+ export dataLoader from "./dataLoader";
2
+ export utils from "./utils";
3
+ export customHooks from "./customHooks";
@@ -0,0 +1,95 @@
1
+ import VALIDATORS from "./Validators";
2
+ let uniqueCounter = 1;
3
+
4
+ const utils = {
5
+ configs: {},
6
+ setDefaultConfigs: function(configs) {
7
+ this.configs = {...this.configs, ...configs};
8
+ },
9
+ getDefaultConfigs: function() {
10
+ return this.configs;
11
+ },
12
+ getDefaultConfig: function(key) {
13
+ return this.configs ? this.configs[key] : "";
14
+ },
15
+ getQueryParams: function(params = {}) {
16
+ let queryParams = [];
17
+
18
+ queryParams = Object.keys(params).map(key => {
19
+ return `${key}=${params[key]}`;
20
+ });
21
+
22
+ return queryParams.join("&");
23
+ },
24
+ isEven: function(value) {
25
+ return value % 2 === 0;
26
+ },
27
+ getPagIndex: function(pageConfig) {
28
+ const { perPageCount, pageNo } = pageConfig;
29
+ const startIndex = (pageNo - 1) * perPageCount;
30
+ const endIndex = pageNo * perPageCount;
31
+
32
+ return {
33
+ start: startIndex,
34
+ end: endIndex
35
+ };
36
+ },
37
+ omit: function(object = {}, omitKeys = []) {
38
+ let newObject = {};
39
+
40
+ for (let key in object) {
41
+ if (omitKeys.indexOf(key) === -1) {
42
+ newObject[key] = object[key];
43
+ }
44
+ }
45
+
46
+ return newObject;
47
+ },
48
+ getUniqueId: function() {
49
+ return uniqueCounter++;
50
+ },
51
+ isObjectEmpty: function(obj) {
52
+ return Object.keys(obj).length ? false : true;
53
+ },
54
+ debounce: function(func, debounceTime) {
55
+ let timeout;
56
+
57
+ return function() {
58
+ const context = this,
59
+ args = arguments;
60
+ clearTimeout(timeout);
61
+ timeout = setTimeout(function() {
62
+ timeout = null;
63
+ func.apply(context, args);
64
+ }, debounceTime);
65
+ };
66
+ },
67
+ checkIfValid: function(value, validations) {
68
+ let isValidValue = true;
69
+ let errorMessage;
70
+
71
+ for (let i = 0; i < validations.length; i++) {
72
+ const validationObj = validations[i];
73
+ const { type, message = "Invalid field value" } = validationObj;
74
+ isValidValue = VALIDATORS[type](value, validationObj);
75
+
76
+ if (!isValidValue) {
77
+ errorMessage = message;
78
+ break;
79
+ }
80
+ }
81
+
82
+ return {
83
+ isValid: isValidValue,
84
+ error: errorMessage
85
+ };
86
+ },
87
+ isObject: function(value) {
88
+ return Object.prototype.toString.call(value) === "[object Object]";
89
+ },
90
+ isArray: function(value) {
91
+ return Object.prototype.toString.call(value) === "[object Array]";
92
+ }
93
+ }
94
+
95
+ export default utils;
package/src/index.js ADDED
@@ -0,0 +1,68 @@
1
+ import {
2
+ Button,
3
+ DropdownButton,
4
+ List,
5
+ Modal,
6
+ InlineModal,
7
+ DataLoader,
8
+ Form,
9
+ Input,
10
+ Textarea,
11
+ Checkbox,
12
+ RadioList,
13
+ Dropdown,
14
+ RangeSlider,
15
+ FileUploader,
16
+ DragDropFileUploader,
17
+ Toggle,
18
+ Table,
19
+ PaginationComponent,
20
+ TabsComponent,
21
+ NotificationComponent,
22
+ ProgressBar,
23
+ Tooltip,
24
+ Accordian
25
+ } from "./components";
26
+
27
+ import {
28
+ dataLoader,
29
+ utils,
30
+ customHooks
31
+ } from "./core";
32
+
33
+ import { ButtonAppearance, ButtonSize } from "./components/Button";
34
+
35
+ import { InlineModalActivator, InlineModalBody } from "./components/InlineModal";
36
+
37
+ export {
38
+ Button,
39
+ ButtonAppearance,
40
+ ButtonSize,
41
+ DropdownButton,
42
+ List,
43
+ Modal,
44
+ InlineModal,
45
+ InlineModalActivator,
46
+ InlineModalBody,
47
+ Form,
48
+ Input,
49
+ Textarea,
50
+ Checkbox,
51
+ RadioList,
52
+ Dropdown,
53
+ RangeSlider,
54
+ FileUploader,
55
+ DragDropFileUploader,
56
+ Toggle,
57
+ DataLoader,
58
+ Table,
59
+ PaginationComponent,
60
+ TabsComponent,
61
+ NotificationComponent,
62
+ ProgressBar,
63
+ Tooltip,
64
+ Accordian,
65
+ dataLoader,
66
+ utils,
67
+ customHooks
68
+ };
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { storiesOf } from "@storybook/react";
3
+ import #{component_name} from "./#{component_name}";
4
+
5
+ storiesOf("#{component_name}", module)
6
+ .add("Simple Usage", () => {
7
+ return (<#{component_name}></#{component_name}>);
8
+ });
File without changes