@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
package/.babelrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "presets": ["@babel/preset-env", "@babel/preset-react"],
3
+ "plugins": [ "@babel/plugin-proposal-export-default-from", "@babel/plugin-proposal-class-properties"]
4
+ }
package/.eslintrc.js ADDED
@@ -0,0 +1,38 @@
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ "es6": true,
5
+ "amd": true,
6
+ "node": true
7
+ },
8
+ "extends": [
9
+ "eslint:recommended",
10
+ "plugin:react/recommended"
11
+ ],
12
+ "globals": {
13
+ "Atomics": "readonly",
14
+ "SharedArrayBuffer": "readonly"
15
+ },
16
+ "parser": "babel-eslint",
17
+ "parserOptions": {
18
+ "ecmaFeatures": {
19
+ "jsx": true
20
+ },
21
+ "ecmaVersion": 2018,
22
+ "sourceType": "module"
23
+ },
24
+ "plugins": [
25
+ "react",
26
+ "babel"
27
+ ],
28
+ "rules": {
29
+ "react/prop-types": [2, { ignore: ["children"] }],
30
+ "no-unsafe-finally": 0,
31
+ "no-func-assign": 0
32
+ },
33
+ "settings": {
34
+ "react": {
35
+ "version": "detect"
36
+ }
37
+ }
38
+ };
package/CONTRIBUTE.md ADDED
@@ -0,0 +1,105 @@
1
+ ## Setting up the project for development
2
+
3
+ ### Prerequisites
4
+
5
+ Install [npm](https://www.npmjs.com/get-npm)
6
+
7
+ ### Setting Up
8
+
9
+ Install the npm packages using the following command
10
+
11
+ ```
12
+ npm install
13
+ ```
14
+
15
+ Start the JS build with watcher using the following command
16
+
17
+ ```
18
+ npm run build -- --watch
19
+ ```
20
+
21
+ To watch SCSS files & compile them to CSS use the following command
22
+
23
+ ```
24
+ npm run scss -- --watch
25
+ ```
26
+
27
+ **Note:** Prefix all the CSS classNames with namespace `"RCB-"`
28
+
29
+ ### Linting your JS files
30
+
31
+ Run the following command to lint the JS code
32
+
33
+ ```
34
+ npm run lint
35
+ ```
36
+
37
+ Or Install your editor specific plugin by referring to [this link](https://eslint.org/docs/user-guide/integrations)
38
+
39
+ ### Viewing the components
40
+
41
+ View the available components along with their accepted props using [storybook](https://storybook.js.org/)
42
+
43
+ To start the storybook run the following command
44
+
45
+ ```
46
+ npm run storybook
47
+ ```
48
+
49
+ The storybook can then be viewed at http://localhost:6006/
50
+
51
+ ### Publishing the storybook to github pages
52
+
53
+ Run the following command to publish the storybook to github pages:
54
+
55
+ ```
56
+ npm run deploy-storybook
57
+ ```
58
+
59
+ ### Publishing the package to npm
60
+
61
+ First login to npm using the following command:
62
+
63
+ ```
64
+ npm login
65
+ ```
66
+
67
+ Then run the following command to publish the package to npm:
68
+
69
+ ```
70
+ npm run publish
71
+ ```
72
+
73
+ This publishes the package to [unbxd-ui](https://www.npmjs.com/settings/unbxd-ui/packages) org on npm.
74
+ To be able to publish to this org you need to get yourself added on the team. Contact Divya or Manu for the same.
75
+
76
+
77
+ ### Creating new stories for the components
78
+
79
+ To help boostrap a new story file, use the following steps
80
+
81
+ 1. Install the VS Code extension [File Templates](https://marketplace.visualstudio.com/items?itemName=brpaz.file-templates)
82
+ 2. Place the templates in the location expected by the extension
83
+ - In Mac,
84
+ ```cp ./vscode-templates/NewStoryTemplate.stories.js $HOME/Library/Application\ Support/Code/User/FileTemplates```
85
+
86
+ - In Linux,
87
+ ```cp ./vscode-templates/NewStoryTemplate.stories.js $HOME/.config/Code/User/FileTemplates```
88
+
89
+ - In Windows,
90
+ ```cp ./vscode-templates/NewStoryTemplate.stories.js C:\Users\User\AppData\Roaming\Code\User\FileTemplates```
91
+ 3. To use the templates you can do one of the following:
92
+ - In VSCode, right click on the folder where you want to generate the new file. You should see an option "Files : New from template". Selecting this option a list of available templates should appear. Just select your template and the file will be created.
93
+ - You can also do the same from the Command Palette. In this case the new file will be created in the root directory of the project.
94
+ - Its also possible to do the other way around and create a template based on an open file. For that "right-click" on any opened file and you should see the option of the context menu.
95
+
96
+ **Note:** The template will expect the Component name as a parameter
97
+
98
+ ## FAQs
99
+ 1) I am getting error "No PostCSS Config found"
100
+
101
+ Create a file called postcss.config.js in `/lib/components/` folder
102
+
103
+ ## TODO
104
+
105
+ - Minify JS / CSS
@@ -1,61 +1,88 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = void 0;
9
+
8
10
  var _react = _interopRequireWildcard(require("react"));
11
+
9
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
10
14
  var _List = _interopRequireDefault(require("../List"));
15
+
11
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
+
12
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
13
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
14
22
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
+
15
24
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
25
+
26
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
27
+
17
28
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
+
18
30
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
31
+
19
32
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
33
+
20
34
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
35
+
21
36
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
37
+
22
38
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
23
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
39
+
40
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
41
+
24
42
  var ALL = "ALL";
43
+
25
44
  var getDefaultOpenedItems = function getDefaultOpenedItems() {
26
45
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
27
46
  var defaultOpen = arguments.length > 1 ? arguments[1] : undefined;
28
47
  var arr = [];
48
+
29
49
  if (items.length > 0) {
30
50
  items.forEach(function (item) {
31
51
  var id = item.id;
52
+
32
53
  if (id === defaultOpen || defaultOpen === ALL) {
33
54
  arr.push(id);
34
55
  }
35
56
  });
36
57
  }
58
+
37
59
  return arr;
38
60
  };
61
+
39
62
  var AccordianItem = function AccordianItem(props) {
40
63
  var itemData = props.itemData,
41
- allowOneOpen = props.allowOneOpen,
42
- openedItems = props.openedItems,
43
- setOpenedItems = props.setOpenedItems;
64
+ allowOneOpen = props.allowOneOpen,
65
+ openedItems = props.openedItems,
66
+ setOpenedItems = props.setOpenedItems;
44
67
  var titleComponent = itemData.titleComponent,
45
- bodyComponent = itemData.bodyComponent,
46
- id = itemData.id;
68
+ bodyComponent = itemData.bodyComponent,
69
+ id = itemData.id;
47
70
  var isOpen = openedItems.find(function (item) {
48
71
  return item === id;
49
72
  }) ? true : false;
73
+
50
74
  var onItemClick = function onItemClick() {
51
75
  var newList = [id];
76
+
52
77
  if (!allowOneOpen) {
53
78
  newList = isOpen ? openedItems.filter(function (item) {
54
79
  return item !== id;
55
80
  }) : [].concat(_toConsumableArray(openedItems), [id]);
56
81
  }
82
+
57
83
  setOpenedItems(newList);
58
84
  };
85
+
59
86
  return /*#__PURE__*/_react["default"].createElement("li", {
60
87
  className: "RCB-accordian-item ".concat(isOpen ? "RCB-accordian-open" : "RCB-accordian-close")
61
88
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -67,6 +94,7 @@ var AccordianItem = function AccordianItem(props) {
67
94
  className: "RCB-accordian-body"
68
95
  }, bodyComponent));
69
96
  };
97
+
70
98
  AccordianItem.propTypes = {
71
99
  itemData: _propTypes["default"].shape({
72
100
  id: _propTypes["default"].string.isRequired,
@@ -77,15 +105,18 @@ AccordianItem.propTypes = {
77
105
  openedItems: _propTypes["default"].array,
78
106
  allowOneOpen: _propTypes["default"].bool
79
107
  };
108
+
80
109
  var Accordian = function Accordian(_ref) {
81
110
  var defaultOpen = _ref.defaultOpen,
82
- items = _ref.items,
83
- allowOneOpen = _ref.allowOneOpen;
111
+ items = _ref.items,
112
+ allowOneOpen = _ref.allowOneOpen;
84
113
  var defaultOpened = getDefaultOpenedItems(items, defaultOpen);
114
+
85
115
  var _useState = (0, _react.useState)(defaultOpened),
86
- _useState2 = _slicedToArray(_useState, 2),
87
- openedItems = _useState2[0],
88
- setOpenedItems = _useState2[1];
116
+ _useState2 = _slicedToArray(_useState, 2),
117
+ openedItems = _useState2[0],
118
+ setOpenedItems = _useState2[1];
119
+
89
120
  return /*#__PURE__*/_react["default"].createElement("div", {
90
121
  className: "RCB-accordian"
91
122
  }, /*#__PURE__*/_react["default"].createElement(_List["default"], {
@@ -97,6 +128,7 @@ var Accordian = function Accordian(_ref) {
97
128
  ListItem: AccordianItem
98
129
  }));
99
130
  };
131
+
100
132
  Accordian.propTypes = {
101
133
  defaultOpen: _propTypes["default"].string,
102
134
  items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
@@ -1,34 +1,50 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = exports.OpenAtLeastOneAlways = exports.DefaultOpen = exports.Default = void 0;
9
+
8
10
  var _react = _interopRequireWildcard(require("react"));
11
+
9
12
  var _Accordian = _interopRequireDefault(require("./Accordian"));
13
+
10
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
+
11
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
12
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
13
20
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
21
+
14
22
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
+
15
24
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
25
+
26
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
27
+
28
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
29
+
18
30
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
+
19
32
  var _default = {
20
33
  title: 'Accordian',
21
34
  component: _Accordian["default"]
22
35
  };
23
36
  exports["default"] = _default;
37
+
24
38
  var AccordianBody = function AccordianBody() {
25
39
  var _useState = (0, _react.useState)(1),
26
- _useState2 = _slicedToArray(_useState, 2),
27
- count = _useState2[0],
28
- setRandomNumber = _useState2[1];
40
+ _useState2 = _slicedToArray(_useState, 2),
41
+ count = _useState2[0],
42
+ setRandomNumber = _useState2[1];
43
+
29
44
  var onSetRandom = function onSetRandom() {
30
45
  setRandomNumber(Math.round(Math.random() * 10));
31
46
  };
47
+
32
48
  return /*#__PURE__*/_react["default"].createElement("div", {
33
49
  style: {
34
50
  padding: '20px'
@@ -37,13 +53,16 @@ var AccordianBody = function AccordianBody() {
37
53
  onClick: onSetRandom
38
54
  }, " changed to ", count));
39
55
  };
56
+
40
57
  var AccordianTitle = function AccordianTitle(_ref) {
41
58
  var id = _ref.id;
42
59
  return /*#__PURE__*/_react["default"].createElement("div", null, "Title ".concat(id));
43
60
  };
61
+
44
62
  var Template = function Template(args) {
45
63
  return /*#__PURE__*/_react["default"].createElement(_Accordian["default"], args);
46
64
  };
65
+
47
66
  var Default = Template.bind();
48
67
  exports.Default = Default;
49
68
  Default.args = {
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
+
7
8
  var _Accordian = _interopRequireDefault(require("./Accordian"));
9
+
8
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
9
12
  var _default = _Accordian["default"];
10
13
  exports["default"] = _default;
@@ -4,13 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.ButtonSize = exports.ButtonAppearance = void 0;
7
+
7
8
  var _react = _interopRequireDefault(require("react"));
9
+
8
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
9
12
  var _excluded = ["children", "className", "loading", "disabled", "appearance", "size", "onClick"];
13
+
10
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
+
16
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
+
12
18
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
+
13
20
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
21
+
14
22
  /** ButtonAppearance enum */
15
23
  var ButtonAppearance = {
16
24
  DEFAULT: "default",
@@ -18,27 +26,30 @@ var ButtonAppearance = {
18
26
  SECONDARY: "secondary"
19
27
  };
20
28
  /** ButtonSize enum */
29
+
21
30
  exports.ButtonAppearance = ButtonAppearance;
22
31
  var ButtonSize = {
23
32
  SMALL: "small",
24
33
  MEDIUM: "medium",
25
34
  LARGE: "large"
26
35
  };
27
-
28
36
  /**
29
37
  *
30
38
  * Displays a Button component
31
39
  */
40
+
32
41
  exports.ButtonSize = ButtonSize;
42
+
33
43
  var Button = function Button(props) {
34
44
  var children = props.children,
35
- className = props.className,
36
- loading = props.loading,
37
- disabled = props.disabled,
38
- appearance = props.appearance,
39
- size = props.size,
40
- onClick = props.onClick,
41
- restProps = _objectWithoutProperties(props, _excluded);
45
+ className = props.className,
46
+ loading = props.loading,
47
+ disabled = props.disabled,
48
+ appearance = props.appearance,
49
+ size = props.size,
50
+ onClick = props.onClick,
51
+ restProps = _objectWithoutProperties(props, _excluded);
52
+
42
53
  var btnClassName = "RCB-btn RCB-btn-".concat(appearance, " RCB-btn-").concat(size, " ").concat(className) + (loading ? " RCB-btn-loading" : "");
43
54
  return /*#__PURE__*/_react["default"].createElement("button", _extends({
44
55
  className: btnClassName,
@@ -46,13 +57,17 @@ var Button = function Button(props) {
46
57
  onClick: onClick
47
58
  }, restProps), children);
48
59
  };
60
+
49
61
  Button.propTypes = {
50
62
  /** Add any additional classes to Button component */
51
63
  className: _propTypes["default"].string,
64
+
52
65
  /** Boolean indicating whether the button should render as disabled */
53
66
  disabled: _propTypes["default"].bool,
67
+
54
68
  /** Boolean indicating whether the button is in loading state */
55
69
  loading: _propTypes["default"].bool,
70
+
56
71
  /** String indicating how Button should be rendered.
57
72
  * Must be one of,
58
73
  * ButtonAppearance = {
@@ -62,6 +77,7 @@ Button.propTypes = {
62
77
  }
63
78
  */
64
79
  appearance: _propTypes["default"].oneOf(Object.values(ButtonAppearance)),
80
+
65
81
  /** String indicating the size of the Button
66
82
  * Must be one of,
67
83
  * ButtonSize = {
@@ -71,6 +87,7 @@ Button.propTypes = {
71
87
  }
72
88
  */
73
89
  size: _propTypes["default"].oneOf(Object.values(ButtonSize)),
90
+
74
91
  /** Button onClick handler */
75
92
  onClick: _propTypes["default"].func
76
93
  };
@@ -1,16 +1,24 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = exports.SimpleUsage = exports.SecondaryButton = exports.PrimaryButton = void 0;
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
11
+
9
12
  var _addonActions = require("@storybook/addon-actions");
13
+
10
14
  var _Button = _interopRequireWildcard(require("./Button"));
15
+
11
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
12
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
13
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
14
22
  var SimpleUsage = function SimpleUsage() {
15
23
  return /*#__PURE__*/_react["default"].createElement("div", {
16
24
  className: "margin-btns"
@@ -25,6 +33,7 @@ var SimpleUsage = function SimpleUsage() {
25
33
  onClick: (0, _addonActions.action)("clicked")
26
34
  }, "LARGE"));
27
35
  };
36
+
28
37
  exports.SimpleUsage = SimpleUsage;
29
38
  SimpleUsage.story = {
30
39
  parameters: {
@@ -33,6 +42,7 @@ SimpleUsage.story = {
33
42
  }
34
43
  }
35
44
  };
45
+
36
46
  var PrimaryButton = function PrimaryButton() {
37
47
  return /*#__PURE__*/_react["default"].createElement("div", {
38
48
  className: "margin-btns"
@@ -50,6 +60,7 @@ var PrimaryButton = function PrimaryButton() {
50
60
  onClick: (0, _addonActions.action)("clicked")
51
61
  }, "LARGE"));
52
62
  };
63
+
53
64
  exports.PrimaryButton = PrimaryButton;
54
65
  PrimaryButton.story = {
55
66
  parameters: {
@@ -58,6 +69,7 @@ PrimaryButton.story = {
58
69
  }
59
70
  }
60
71
  };
72
+
61
73
  var SecondaryButton = function SecondaryButton() {
62
74
  return /*#__PURE__*/_react["default"].createElement("div", {
63
75
  className: "margin-btns"
@@ -75,6 +87,7 @@ var SecondaryButton = function SecondaryButton() {
75
87
  onClick: (0, _addonActions.action)("clicked")
76
88
  }, "LARGE"));
77
89
  };
90
+
78
91
  exports.SecondaryButton = SecondaryButton;
79
92
  SecondaryButton.story = {
80
93
  parameters: {
@@ -1,34 +1,50 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = void 0;
9
+
8
10
  var _react = _interopRequireWildcard(require("react"));
11
+
9
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
10
14
  var _InlineModal = _interopRequireWildcard(require("../InlineModal"));
15
+
11
16
  var _List = _interopRequireDefault(require("../List"));
17
+
12
18
  var _excluded = ["label", "options", "className", "onClick", "DropdownButtonItem"];
19
+
13
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
14
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
15
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
+
26
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
+
17
28
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
+
18
30
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
31
+
19
32
  var DefaultDropdownButtonItem = function DefaultDropdownButtonItem(props) {
20
33
  var _props$itemData = props.itemData,
21
- itemData = _props$itemData === void 0 ? {} : _props$itemData,
22
- onClick = props.onClick;
34
+ itemData = _props$itemData === void 0 ? {} : _props$itemData,
35
+ onClick = props.onClick;
23
36
  var name = itemData.name;
37
+
24
38
  var onItemClicked = function onItemClicked() {
25
39
  onClick(itemData);
26
40
  };
41
+
27
42
  return /*#__PURE__*/_react["default"].createElement("li", {
28
43
  className: "RCB-list-item",
29
44
  onClick: onItemClicked
30
45
  }, name);
31
46
  };
47
+
32
48
  DefaultDropdownButtonItem.propTypes = {
33
49
  itemData: _propTypes["default"].shape({
34
50
  id: _propTypes["default"].string.isRequired,
@@ -36,18 +52,22 @@ DefaultDropdownButtonItem.propTypes = {
36
52
  }).isRequired,
37
53
  onClick: _propTypes["default"].func.isRequired
38
54
  };
55
+
39
56
  var DropdownButton = function DropdownButton(props) {
40
57
  var label = props.label,
41
- options = props.options,
42
- className = props.className,
43
- onClick = props.onClick,
44
- DropdownButtonItem = props.DropdownButtonItem,
45
- restProps = _objectWithoutProperties(props, _excluded);
58
+ options = props.options,
59
+ className = props.className,
60
+ onClick = props.onClick,
61
+ DropdownButtonItem = props.DropdownButtonItem,
62
+ restProps = _objectWithoutProperties(props, _excluded);
63
+
46
64
  var modalRef = (0, _react.useRef)();
65
+
47
66
  var onItemClicked = function onItemClicked(itemData) {
48
67
  onClick(itemData);
49
68
  modalRef.current.hideModal();
50
69
  };
70
+
51
71
  return /*#__PURE__*/_react["default"].createElement(_InlineModal["default"], {
52
72
  className: "RCB-dropdown-button ".concat(className),
53
73
  ref: modalRef
@@ -57,8 +77,10 @@ var DropdownButton = function DropdownButton(props) {
57
77
  onClick: onItemClicked
58
78
  }, restProps))));
59
79
  };
80
+
60
81
  DropdownButton.propTypes = {
61
82
  label: _propTypes["default"].string,
83
+
62
84
  /** Dropdown items list */
63
85
  options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
64
86
  id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),