@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.
- package/.babelrc +4 -0
- package/.eslintrc.js +38 -0
- package/CONTRIBUTE.md +105 -0
- package/components/Accordian/Accordian.js +45 -13
- package/components/Accordian/Accordian.stories.js +25 -6
- package/components/Accordian/index.js +3 -0
- package/components/Button/Button.js +26 -9
- package/components/Button/Button.stories.js +14 -1
- package/components/Button/DropdownButton.js +31 -9
- package/components/Button/DropdownButton.stories.js +23 -6
- package/components/Button/index.js +8 -1
- package/components/DataLoader/DataLoader.js +40 -10
- package/components/DataLoader/DataLoader.stories.js +30 -5
- package/components/DataLoader/index.js +3 -0
- package/components/Form/Checkbox.js +42 -14
- package/components/Form/DragDropFileUploader.js +42 -12
- package/components/Form/Dropdown.js +181 -104
- package/components/Form/FileUploader.js +32 -10
- package/components/Form/Form.js +45 -15
- package/components/Form/FormElementWrapper.js +7 -2
- package/components/Form/Input.js +72 -27
- package/components/Form/RadioList.js +48 -17
- package/components/Form/RangeSlider.js +73 -37
- package/components/Form/ServerPaginatedDDList.js +130 -86
- package/components/Form/Textarea.js +43 -18
- package/components/Form/Toggle.js +48 -16
- package/components/Form/index.js +30 -18
- package/components/Form/stories/Checkbox.stories.js +12 -1
- package/components/Form/stories/DragDropFileUploader.stories.js +8 -0
- package/components/Form/stories/Dropdown.stories.js +24 -6
- package/components/Form/stories/FileUploader.stories.js +8 -0
- package/components/Form/stories/FormDefault.stories.js +21 -1
- package/components/Form/stories/RadioList.stories.js +12 -1
- package/components/Form/stories/RangeSlider.stories.js +15 -1
- package/components/Form/stories/TextInput.stories.js +19 -3
- package/components/Form/stories/Textarea.stories.js +12 -1
- package/components/Form/stories/Toggle.stories.js +7 -0
- package/components/Form/stories/form.stories.js +40 -3
- package/components/InlineModal/InlineModal.js +51 -14
- package/components/InlineModal/InlineModal.stories.js +14 -2
- package/components/InlineModal/index.js +6 -1
- package/components/List/List.js +24 -9
- package/components/List/index.js +3 -0
- package/components/List/list.stories.js +10 -0
- package/components/Modal/Modal.js +49 -17
- package/components/Modal/Modal.stories.js +15 -1
- package/components/Modal/index.js +3 -0
- package/components/NotificationComponent/NotificationComponent.js +34 -11
- package/components/NotificationComponent/NotificationComponent.stories.js +6 -0
- package/components/NotificationComponent/index.js +3 -0
- package/components/ProgressBar/ProgressBar.js +11 -2
- package/components/ProgressBar/ProgressBar.stories.js +6 -0
- package/components/ProgressBar/index.js +3 -0
- package/components/Table/BaseTable.js +134 -69
- package/components/Table/PaginationComponent.js +23 -11
- package/components/Table/Table.js +149 -68
- package/components/Table/Table.stories.js +67 -22
- package/components/Table/index.js +4 -0
- package/components/TabsComponent/TabsComponent.js +57 -20
- package/components/TabsComponent/TabsComponent.stories.js +16 -0
- package/components/TabsComponent/index.js +3 -0
- package/components/Tooltip/Tooltip.js +47 -25
- package/components/Tooltip/Tooltip.stories.js +6 -0
- package/components/Tooltip/index.js +3 -0
- package/components/core.css +1 -3
- package/components/index.js +17 -1
- package/components/theme.css +0 -2
- package/lib/Readme.md +82 -0
- package/lib/components/Accordian/Accordian.js +117 -0
- package/lib/components/Accordian/Accordian.stories.js +137 -0
- package/lib/components/Accordian/index.js +10 -0
- package/lib/components/Button/Button.js +84 -0
- package/lib/components/Button/Button.stories.js +89 -0
- package/lib/components/Button/DropdownButton.js +77 -0
- package/lib/components/Button/DropdownButton.stories.js +51 -0
- package/lib/components/Button/index.js +32 -0
- package/lib/components/DataLoader/DataLoader.js +88 -0
- package/lib/components/DataLoader/DataLoader.stories.js +77 -0
- package/lib/components/DataLoader/index.js +10 -0
- package/lib/components/Form/Checkbox.js +93 -0
- package/lib/components/Form/DragDropFileUploader.js +85 -0
- package/lib/components/Form/Dropdown.js +478 -0
- package/lib/components/Form/FileUploader.js +81 -0
- package/lib/components/Form/Form.js +106 -0
- package/lib/components/Form/FormElementWrapper.js +27 -0
- package/lib/components/Form/Input.js +140 -0
- package/lib/components/Form/RadioList.js +111 -0
- package/lib/components/Form/RangeSlider.js +142 -0
- package/lib/components/Form/ServerPaginatedDDList.js +267 -0
- package/lib/components/Form/Textarea.js +95 -0
- package/lib/components/Form/Toggle.js +117 -0
- package/lib/components/Form/index.js +73 -0
- package/lib/components/Form/stories/Checkbox.stories.js +54 -0
- package/lib/components/Form/stories/DragDropFileUploader.stories.js +27 -0
- package/lib/components/Form/stories/Dropdown.stories.js +114 -0
- package/lib/components/Form/stories/FileUploader.stories.js +31 -0
- package/lib/components/Form/stories/FormDefault.stories.js +117 -0
- package/lib/components/Form/stories/RadioList.stories.js +55 -0
- package/lib/components/Form/stories/RangeSlider.stories.js +82 -0
- package/lib/components/Form/stories/TextInput.stories.js +79 -0
- package/lib/components/Form/stories/Textarea.stories.js +48 -0
- package/lib/components/Form/stories/Toggle.stories.js +25 -0
- package/lib/components/Form/stories/form.stories.js +240 -0
- package/lib/components/InlineModal/InlineModal.js +146 -0
- package/lib/components/InlineModal/InlineModal.stories.js +61 -0
- package/lib/components/InlineModal/index.js +24 -0
- package/lib/components/List/List.js +76 -0
- package/lib/components/List/index.js +10 -0
- package/lib/components/List/list.stories.js +38 -0
- package/lib/components/Modal/Modal.js +117 -0
- package/lib/components/Modal/Modal.stories.js +55 -0
- package/lib/components/Modal/index.js +10 -0
- package/lib/components/NotificationComponent/NotificationComponent.js +76 -0
- package/lib/components/NotificationComponent/NotificationComponent.stories.js +29 -0
- package/lib/components/NotificationComponent/index.js +10 -0
- package/lib/components/ProgressBar/ProgressBar.js +49 -0
- package/lib/components/ProgressBar/ProgressBar.stories.js +21 -0
- package/lib/components/ProgressBar/index.js +10 -0
- package/lib/components/Table/BaseTable.js +352 -0
- package/lib/components/Table/PaginationComponent.js +87 -0
- package/lib/components/Table/Table.js +333 -0
- package/lib/components/Table/Table.stories.js +204 -0
- package/lib/components/Table/index.js +17 -0
- package/lib/components/TabsComponent/TabsComponent.js +134 -0
- package/lib/components/TabsComponent/TabsComponent.stories.js +65 -0
- package/lib/components/TabsComponent/index.js +10 -0
- package/lib/components/Tooltip/Tooltip.js +102 -0
- package/lib/components/Tooltip/Tooltip.stories.js +25 -0
- package/lib/components/Tooltip/index.js +10 -0
- package/lib/components/core.css +3 -0
- package/lib/components/core.scss +29 -0
- package/lib/components/index.js +159 -0
- package/lib/components/theme.css +3 -0
- package/lib/components/theme.scss +11 -0
- package/lib/package-lock.json +20607 -0
- package/lib/package.json +94 -0
- package/package.json +1 -1
- package/src/Intro.stories.mdx +119 -0
- package/src/components/Accordian/Accordian.js +89 -0
- package/src/components/Accordian/Accordian.stories.js +92 -0
- package/src/components/Accordian/accordianCore.css +1 -0
- package/src/components/Accordian/accordianCore.scss +8 -0
- package/src/components/Accordian/accordianTheme.css +1 -0
- package/src/components/Accordian/accordianTheme.scss +6 -0
- package/src/components/Accordian/index.js +3 -0
- package/src/components/Button/Button.js +67 -0
- package/src/components/Button/Button.stories.js +103 -0
- package/src/components/Button/DropdownButton.js +60 -0
- package/src/components/Button/DropdownButton.stories.js +38 -0
- package/src/components/Button/button.css +1 -0
- package/src/components/Button/buttonTheme.css +1 -0
- package/src/components/Button/buttonTheme.scss +45 -0
- package/src/components/Button/index.js +5 -0
- package/src/components/DataLoader/DataLoader.js +86 -0
- package/src/components/DataLoader/DataLoader.stories.js +72 -0
- package/src/components/DataLoader/index.js +3 -0
- package/src/components/Form/Checkbox.js +73 -0
- package/src/components/Form/DragDropFileUploader.js +67 -0
- package/src/components/Form/Dropdown.js +430 -0
- package/src/components/Form/FileUploader.js +64 -0
- package/src/components/Form/Form.js +83 -0
- package/src/components/Form/FormElementWrapper.js +22 -0
- package/src/components/Form/Input.js +121 -0
- package/src/components/Form/RadioList.js +86 -0
- package/src/components/Form/RangeSlider.js +100 -0
- package/src/components/Form/ServerPaginatedDDList.js +231 -0
- package/src/components/Form/Textarea.js +76 -0
- package/src/components/Form/Toggle.js +96 -0
- package/src/components/Form/form.css +1 -0
- package/src/components/Form/formCore.css +1 -0
- package/src/components/Form/formCore.scss +142 -0
- package/src/components/Form/formTheme.css +1 -0
- package/src/components/Form/formTheme.scss +27 -0
- package/src/components/Form/index.js +13 -0
- package/src/components/Form/stories/Checkbox.stories.js +41 -0
- package/src/components/Form/stories/DragDropFileUploader.stories.js +21 -0
- package/src/components/Form/stories/Dropdown.stories.js +124 -0
- package/src/components/Form/stories/FileUploader.stories.js +21 -0
- package/src/components/Form/stories/FormDefault.stories.js +87 -0
- package/src/components/Form/stories/RadioList.stories.js +48 -0
- package/src/components/Form/stories/RangeSlider.stories.js +84 -0
- package/src/components/Form/stories/TextInput.stories.js +77 -0
- package/src/components/Form/stories/Textarea.stories.js +43 -0
- package/src/components/Form/stories/Toggle.stories.js +14 -0
- package/src/components/Form/stories/form.stories.js +216 -0
- package/src/components/InlineModal/InlineModal.js +135 -0
- package/src/components/InlineModal/InlineModal.stories.js +54 -0
- package/src/components/InlineModal/index.js +4 -0
- package/src/components/InlineModal/inlineModal.css +1 -0
- package/src/components/InlineModal/inlineModalCore.css +1 -0
- package/src/components/InlineModal/inlineModalCore.scss +31 -0
- package/src/components/InlineModal/inlineModalTheme.css +1 -0
- package/src/components/InlineModal/inlineModalTheme.scss +16 -0
- package/src/components/List/List.js +72 -0
- package/src/components/List/index.js +3 -0
- package/src/components/List/list.css +1 -0
- package/src/components/List/list.stories.js +28 -0
- package/src/components/List/listCore.css +1 -0
- package/src/components/List/listCore.scss +6 -0
- package/src/components/List/listTheme.css +0 -0
- package/src/components/List/listTheme.scss +0 -0
- package/src/components/Modal/Modal.js +99 -0
- package/src/components/Modal/Modal.stories.js +54 -0
- package/src/components/Modal/index.js +3 -0
- package/src/components/Modal/modal.css +1 -0
- package/src/components/Modal/modalCore.css +1 -0
- package/src/components/Modal/modalCore.scss +34 -0
- package/src/components/Modal/modalTheme.css +0 -0
- package/src/components/Modal/modalTheme.scss +0 -0
- package/src/components/NotificationComponent/NotificationComponent.js +58 -0
- package/src/components/NotificationComponent/NotificationComponent.stories.js +28 -0
- package/src/components/NotificationComponent/index.js +3 -0
- package/src/components/NotificationComponent/notificationComponent.css +1 -0
- package/src/components/NotificationComponent/notificationTheme.css +1 -0
- package/src/components/NotificationComponent/notificationTheme.scss +30 -0
- package/src/components/ProgressBar/ProgressBar.js +45 -0
- package/src/components/ProgressBar/ProgressBar.stories.js +14 -0
- package/src/components/ProgressBar/index.js +3 -0
- package/src/components/ProgressBar/progressBar.css +1 -0
- package/src/components/ProgressBar/progressBarCore.css +1 -0
- package/src/components/ProgressBar/progressBarCore.scss +14 -0
- package/src/components/ProgressBar/progressBarTheme.css +0 -0
- package/src/components/ProgressBar/progressBarTheme.scss +0 -0
- package/src/components/Table/BaseTable.js +306 -0
- package/src/components/Table/PaginationComponent.js +73 -0
- package/src/components/Table/Table.js +295 -0
- package/src/components/Table/Table.stories.js +198 -0
- package/src/components/Table/index.js +8 -0
- package/src/components/Table/table.css +1 -0
- package/src/components/Table/tableCore.css +1 -0
- package/src/components/Table/tableCore.scss +94 -0
- package/src/components/Table/tableTheme.css +1 -0
- package/src/components/Table/tableTheme.scss +34 -0
- package/src/components/TabsComponent/TabsComponent.js +99 -0
- package/src/components/TabsComponent/TabsComponent.stories.js +69 -0
- package/src/components/TabsComponent/index.js +3 -0
- package/src/components/TabsComponent/tabs.css +1 -0
- package/src/components/TabsComponent/tabsCore.css +1 -0
- package/src/components/TabsComponent/tabsCore.scss +59 -0
- package/src/components/TabsComponent/tabsTheme.css +0 -0
- package/src/components/TabsComponent/tabsTheme.scss +0 -0
- package/src/components/Tooltip/Tooltip.js +87 -0
- package/src/components/Tooltip/Tooltip.stories.js +16 -0
- package/src/components/Tooltip/index.js +3 -0
- package/src/components/Tooltip/tooltipCore.css +1 -0
- package/src/components/Tooltip/tooltipCore.scss +22 -0
- package/src/components/Tooltip/tooltipTheme.css +1 -0
- package/src/components/Tooltip/tooltipTheme.scss +21 -0
- package/src/components/core.css +1 -0
- package/src/components/core.scss +29 -0
- package/src/components/index.js +38 -0
- package/src/components/theme.css +1 -0
- package/src/components/theme.scss +11 -0
- package/src/core/Validators.js +34 -0
- package/src/core/customHooks.js +20 -0
- package/src/core/dataLoader.js +143 -0
- package/src/core/dataLoader.stories.js +123 -0
- package/src/core/index.js +3 -0
- package/src/core/utils.js +95 -0
- package/src/index.js +68 -0
- package/vscode-templates/NewStoryTemplate.stories.js +8 -0
- /package/{Readme.md → README.md} +0 -0
- /package/{components → lib/components}/Accordian/accordianCore.css +0 -0
- /package/{components → lib/components}/Accordian/accordianTheme.css +0 -0
- /package/{components → lib/components}/Button/buttonTheme.css +0 -0
- /package/{components → lib/components}/Form/formCore.css +0 -0
- /package/{components → lib/components}/Form/formTheme.css +0 -0
- /package/{components → lib/components}/InlineModal/inlineModalCore.css +0 -0
- /package/{components → lib/components}/InlineModal/inlineModalTheme.css +0 -0
- /package/{components → lib/components}/List/listCore.css +0 -0
- /package/{components → lib/components}/List/listTheme.css +0 -0
- /package/{components → lib/components}/Modal/modalCore.css +0 -0
- /package/{components → lib/components}/Modal/modalTheme.css +0 -0
- /package/{components → lib/components}/NotificationComponent/notificationTheme.css +0 -0
- /package/{components → lib/components}/ProgressBar/progressBarCore.css +0 -0
- /package/{components → lib/components}/ProgressBar/progressBarTheme.css +0 -0
- /package/{components → lib/components}/Table/tableCore.css +0 -0
- /package/{components → lib/components}/Table/tableTheme.css +0 -0
- /package/{components → lib/components}/TabsComponent/tabsCore.css +0 -0
- /package/{components → lib/components}/TabsComponent/tabsTheme.css +0 -0
- /package/{components → lib/components}/Tooltip/tooltipCore.css +0 -0
- /package/{components → lib/components}/Tooltip/tooltipTheme.css +0 -0
- /package/{core → lib/core}/Validators.js +0 -0
- /package/{core → lib/core}/customHooks.js +0 -0
- /package/{core → lib/core}/dataLoader.js +0 -0
- /package/{core → lib/core}/dataLoader.stories.js +0 -0
- /package/{core → lib/core}/index.js +0 -0
- /package/{core → lib/core}/utils.js +0 -0
- /package/{index.js → lib/index.js} +0 -0
package/.babelrc
ADDED
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";
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
64
|
+
allowOneOpen = props.allowOneOpen,
|
|
65
|
+
openedItems = props.openedItems,
|
|
66
|
+
setOpenedItems = props.setOpenedItems;
|
|
44
67
|
var titleComponent = itemData.titleComponent,
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
83
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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";
|
|
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
|
-
|
|
17
|
-
function
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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";
|
|
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";
|
|
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
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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]),
|