beem-component 1.5.7 → 1.6.0
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/.eslintrc +62 -0
- package/.prettierrc +6 -0
- package/babel.config.js +9 -10
- package/dist/components/Accordion/Accordion.js +7 -7
- package/dist/components/Accordion/Accordion.stories.js +28 -28
- package/dist/components/Avatars/avatars.js +22 -22
- package/dist/components/Avatars/avatars.stories.js +17 -17
- package/dist/components/BannerCard/bannerCard.stories.js +12 -12
- package/dist/components/BannerCard/bannerCards.js +14 -14
- package/dist/components/Buttons/Stories/basicbutton.stories.js +23 -23
- package/dist/components/Buttons/Stories/buttonAlertIcons.stories.js +16 -16
- package/dist/components/Buttons/Stories/buttonIconsOnly.stories.js +16 -16
- package/dist/components/Buttons/buttonAlertIcons.js +16 -16
- package/dist/components/Buttons/buttonIconsOnly.js +22 -22
- package/dist/components/Buttons/buttons.js +56 -56
- package/dist/components/Cards/cards.js +1 -1
- package/dist/components/Cards/cards.stories.js +6 -6
- package/dist/components/ChatComponents/ChatBody/chatBody.js +36 -36
- package/dist/components/ChatComponents/ChatBody/chatBody.stories.js +4 -4
- package/dist/components/ChatComponents/ChatHeader/chatHeader.js +1 -1
- package/dist/components/ChatComponents/ChatHeader/chatHeader.stories.js +1 -1
- package/dist/components/ChatComponents/ColorPicker/colorPicker.stories.js +7 -3
- package/dist/components/ChatComponents/ContactCards/contactCards.js +1 -2
- package/dist/components/ChatComponents/ContactCards/contactCards.stories.js +1 -1
- package/dist/components/ChatComponents/FormAccordion/FormAccordion.stories.js +9 -5
- package/dist/components/ChatComponents/InfoTab/infoTab.js +1 -1
- package/dist/components/ChatComponents/InfoTab/infoTab.stories.js +4 -4
- package/dist/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +12 -7
- package/dist/components/ChatComponents/NoteAccordion/NoteAccordion.stories.js +14 -12
- package/dist/components/Checkbox/checkboxToggler.js +64 -0
- package/dist/components/Checkbox/checkboxToggler.stories.js +92 -0
- package/dist/components/Lists/listBox.js +5 -5
- package/dist/components/Lists/listBox.stories.js +5 -5
- package/dist/components/Lists/listHeader.stories.js +11 -11
- package/dist/components/Lists/listheader.js +4 -4
- package/dist/components/Lists/rowLabels.js +2 -2
- package/dist/components/Lists/rowLabels.stories.js +16 -16
- package/dist/components/Loader/loader.js +7 -7
- package/dist/components/Loader/loader.stories.js +11 -11
- package/dist/components/MessageCounter/MessageCounter.stories.js +13 -13
- package/dist/components/MessageCounter/messageCounter.js +11 -11
- package/dist/components/Modals/modal.js +6 -8
- package/dist/components/Modals/modals.stories.js +6 -6
- package/dist/components/NoteBar/noteBar.js +14 -14
- package/dist/components/NoteBar/noteBar.stories.js +15 -15
- package/dist/components/PerformanceIndicator/performaceIndicator.stories.js +13 -13
- package/dist/components/PerformanceIndicator/performanceIndicator.js +14 -12
- package/dist/components/Pills/pills.js +10 -10
- package/dist/components/Pills/pills.stories.js +19 -21
- package/dist/components/ProfileIcon/ProfileIcon.js +14 -14
- package/dist/components/ProfileIcon/profileIcon.stories.js +16 -16
- package/dist/components/ProgressBar/progressbar.stories.js +6 -8
- package/dist/components/ProgressRing/progressRing.js +19 -19
- package/dist/components/ProgressRing/progressRing.stories.js +14 -14
- package/dist/components/RouteLink/link.js +3 -3
- package/dist/components/RouteLink/link.stories.js +1 -1
- package/dist/components/ScrollBar/scrollBar.js +9 -9
- package/dist/components/SuperFluid/SegmentCard/index.js +2 -2
- package/dist/components/Tabs/tabs.js +6 -6
- package/dist/components/Tabs/tabs.stories.js +17 -17
- package/dist/components/Tags/tags.js +21 -21
- package/dist/components/Tags/tags.stories.js +16 -16
- package/dist/components/breakpoints.js +3 -3
- package/dist/components/checkbox.js +4 -4
- package/dist/components/colors.js +32 -30
- package/dist/components/dropdownButton.js +35 -35
- package/dist/components/examples/InfoAccordion.js +0 -1
- package/dist/components/iconStyles.js +45 -45
- package/dist/components/index.js +32 -16
- package/dist/components/input.js +16 -16
- package/dist/components/typography.js +14 -14
- package/package.json +54 -31
- package/src/App.js +10 -7
- package/src/index.js +6 -8
- package/src/lib/components/Accordion/Accordion.js +32 -14
- package/src/lib/components/Accordion/Accordion.stories.js +31 -31
- package/src/lib/components/Avatars/avatars.js +33 -28
- package/src/lib/components/Avatars/avatars.stories.js +18 -18
- package/src/lib/components/BannerCard/bannerCard.stories.js +16 -17
- package/src/lib/components/BannerCard/bannerCards.js +18 -18
- package/src/lib/components/Buttons/Stories/basicbutton.stories.js +29 -29
- package/src/lib/components/Buttons/Stories/buttonAlertIcons.stories.js +17 -17
- package/src/lib/components/Buttons/Stories/buttonIconsOnly.stories.js +24 -24
- package/src/lib/components/Buttons/buttonAlertIcons.js +22 -25
- package/src/lib/components/Buttons/buttonIconsOnly.js +32 -28
- package/src/lib/components/Buttons/buttons.js +70 -73
- package/src/lib/components/Cards/cards.js +2 -3
- package/src/lib/components/Cards/cards.stories.js +10 -10
- package/src/lib/components/ChatComponents/ChatBody/chatBody.js +46 -45
- package/src/lib/components/ChatComponents/ChatBody/chatBody.stories.js +34 -28
- package/src/lib/components/ChatComponents/ChatBody/sessionDetails.js +2 -2
- package/src/lib/components/ChatComponents/ChatHeader/chatHeader.js +2 -2
- package/src/lib/components/ChatComponents/ChatHeader/chatHeader.stories.js +4 -4
- package/src/lib/components/ChatComponents/ColorPicker/colorPicker.js +2 -2
- package/src/lib/components/ChatComponents/ColorPicker/colorPicker.stories.js +4 -3
- package/src/lib/components/ChatComponents/ContactCards/contactCards.js +7 -5
- package/src/lib/components/ChatComponents/ContactCards/contactCards.stories.js +6 -6
- package/src/lib/components/ChatComponents/FormAccordion/FormAccordion.js +3 -3
- package/src/lib/components/ChatComponents/FormAccordion/FormAccordion.stories.js +4 -3
- package/src/lib/components/ChatComponents/InfoTab/infoTab.js +2 -2
- package/src/lib/components/ChatComponents/InfoTab/infoTab.stories.js +7 -7
- package/src/lib/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +5 -3
- package/src/lib/components/ChatComponents/NoteAccordion/NoteAccordion.js +2 -2
- package/src/lib/components/ChatComponents/NoteAccordion/NoteAccordion.stories.js +6 -5
- package/src/lib/components/Checkbox/checkboxToggler.js +89 -0
- package/src/lib/components/Checkbox/checkboxToggler.stories.js +48 -0
- package/src/lib/components/Lists/listBox.js +7 -7
- package/src/lib/components/Lists/listBox.stories.js +8 -11
- package/src/lib/components/Lists/listHeader.stories.js +13 -13
- package/src/lib/components/Lists/listheader.js +7 -7
- package/src/lib/components/Lists/rowLabels.js +6 -6
- package/src/lib/components/Lists/rowLabels.stories.js +18 -18
- package/src/lib/components/Loader/loader.js +13 -13
- package/src/lib/components/Loader/loader.stories.js +14 -14
- package/src/lib/components/MainWrapper/index.js +2 -2
- package/src/lib/components/MessageCounter/MessageCounter.stories.js +14 -14
- package/src/lib/components/MessageCounter/messageCounter.js +16 -16
- package/src/lib/components/Modals/modal.js +25 -23
- package/src/lib/components/Modals/modals.stories.js +9 -9
- package/src/lib/components/NoteBar/noteBar.js +20 -20
- package/src/lib/components/NoteBar/noteBar.stories.js +18 -17
- package/src/lib/components/PerformanceIndicator/performaceIndicator.stories.js +15 -15
- package/src/lib/components/PerformanceIndicator/performanceIndicator.js +11 -10
- package/src/lib/components/Pills/pills.js +16 -16
- package/src/lib/components/Pills/pills.stories.js +22 -23
- package/src/lib/components/ProfileIcon/ProfileIcon.js +50 -52
- package/src/lib/components/ProfileIcon/profileIcon.stories.js +22 -22
- package/src/lib/components/ProgressBar/progressbar.js +4 -5
- package/src/lib/components/ProgressBar/progressbar.stories.js +8 -9
- package/src/lib/components/ProgressRing/progressRing.js +25 -24
- package/src/lib/components/ProgressRing/progressRing.stories.js +18 -18
- package/src/lib/components/RouteLink/link.js +10 -8
- package/src/lib/components/RouteLink/link.stories.js +4 -4
- package/src/lib/components/ScrollBar/scrollBar.js +15 -14
- package/src/lib/components/SuperFluid/Content/index.js +2 -2
- package/src/lib/components/SuperFluid/ContentTitle.js/index.js +2 -2
- package/src/lib/components/SuperFluid/SegmentCard/index.js +9 -8
- package/src/lib/components/Tabs/tabs.js +11 -11
- package/src/lib/components/Tabs/tabs.stories.js +20 -20
- package/src/lib/components/Tags/tags.js +26 -24
- package/src/lib/components/Tags/tags.stories.js +19 -19
- package/src/lib/components/breakpoints.js +3 -3
- package/src/lib/components/checkbox.js +7 -6
- package/src/lib/components/colors.js +30 -28
- package/src/lib/components/dropdownButton.js +36 -39
- package/src/lib/components/examples/InfoAccordion.js +1 -1
- package/src/lib/components/globalStyles.js +2 -2
- package/src/lib/components/iconStyles.js +45 -48
- package/src/lib/components/index.js +48 -45
- package/src/lib/components/input.js +20 -20
- package/src/lib/components/text.js +1 -1
- package/src/lib/components/typography.js +14 -14
- package/src/reportWebVitals.js +1 -1
- package/dist/components/checkboxToggler.js +0 -50
- package/src/lib/components/checkboxToggler.js +0 -19
package/package.json
CHANGED
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beem-component",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/components/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"start": "PORT=3002 react-scripts start",
|
|
8
7
|
"build": "react-scripts build",
|
|
9
|
-
"
|
|
10
|
-
"eject": "react-scripts eject",
|
|
8
|
+
"build-storybook": "build-storybook",
|
|
11
9
|
"clean": "rimraf dist",
|
|
12
10
|
"compile": "npm run clean && cross-env NODE_ENV=production babel src/lib --out-dir dist --copy-files --ignore __tests__,spec.js,test.js,stories.js,__snapshots__",
|
|
11
|
+
"eject": "react-scripts eject",
|
|
12
|
+
"start": "PORT=3002 react-scripts start",
|
|
13
13
|
"storybook": "start-storybook -p 6006",
|
|
14
|
-
"
|
|
14
|
+
"test": "react-scripts test"
|
|
15
15
|
},
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
"browserslist": {
|
|
17
|
+
"production": [
|
|
18
|
+
">0.2%",
|
|
19
|
+
"not dead",
|
|
20
|
+
"not op_mini all"
|
|
21
|
+
],
|
|
22
|
+
"development": [
|
|
23
|
+
"last 1 chrome version",
|
|
24
|
+
"last 1 firefox version",
|
|
25
|
+
"last 1 safari version"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"eslintConfig": {
|
|
29
|
+
"extends": [
|
|
30
|
+
"react-app",
|
|
31
|
+
"react-app/jest"
|
|
32
|
+
]
|
|
22
33
|
},
|
|
23
34
|
"dependencies": {
|
|
24
35
|
"@emotion/react": "^11.7.1",
|
|
@@ -30,6 +41,7 @@
|
|
|
30
41
|
"js-file-download": "^0.4.12",
|
|
31
42
|
"node-sass": "^6.0.1",
|
|
32
43
|
"polished": "^4.1.3",
|
|
44
|
+
"prop-types": "^15.8.1",
|
|
33
45
|
"react": "^17.0.2",
|
|
34
46
|
"react-dom": "^17.0.2",
|
|
35
47
|
"react-router-dom": "^5.3.0",
|
|
@@ -38,29 +50,14 @@
|
|
|
38
50
|
"styled-components": "^5.3.0",
|
|
39
51
|
"web-vitals": "^1.1.2"
|
|
40
52
|
},
|
|
41
|
-
"eslintConfig": {
|
|
42
|
-
"extends": [
|
|
43
|
-
"react-app",
|
|
44
|
-
"react-app/jest"
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"browserslist": {
|
|
48
|
-
"production": [
|
|
49
|
-
">0.2%",
|
|
50
|
-
"not dead",
|
|
51
|
-
"not op_mini all"
|
|
52
|
-
],
|
|
53
|
-
"development": [
|
|
54
|
-
"last 1 chrome version",
|
|
55
|
-
"last 1 firefox version",
|
|
56
|
-
"last 1 safari version"
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
53
|
"devDependencies": {
|
|
60
|
-
"@babel/cli": "^7.
|
|
54
|
+
"@babel/cli": "^7.16.0",
|
|
55
|
+
"@babel/core": "^7.16.0",
|
|
61
56
|
"@babel/preset-env": "^7.14.8",
|
|
62
57
|
"@babel/preset-react": "^7.14.5",
|
|
63
|
-
"
|
|
58
|
+
"@commitlint/cli": "^14.1.0",
|
|
59
|
+
"@commitlint/config-conventional": "^14.1.0",
|
|
60
|
+
"@commitlint/travis-cli": "^14.1.0",
|
|
64
61
|
"@storybook/addon-actions": "^6.3.2",
|
|
65
62
|
"@storybook/addon-controls": "^6.3.12",
|
|
66
63
|
"@storybook/addon-docs": "^6.3.12",
|
|
@@ -72,6 +69,32 @@
|
|
|
72
69
|
"@storybook/preset-create-react-app": "^3.2.0",
|
|
73
70
|
"@storybook/react": "^6.3.2",
|
|
74
71
|
"@storybook/theming": "^6.4.9",
|
|
72
|
+
"babel-eslint": "^10.1.0",
|
|
73
|
+
"babel-plugin-react-intl": "^5.1.18",
|
|
74
|
+
"babel-plugin-styled-components": "^1.13.3",
|
|
75
|
+
"babel-preset-react-app": "^10.0.0",
|
|
76
|
+
"commitizen": "^4.2.4",
|
|
77
|
+
"cross-env": "^7.0.3",
|
|
78
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
79
|
+
"eslint-config-airbnb": "^18.2.1",
|
|
80
|
+
"eslint-config-prettier": "^8.3.0",
|
|
81
|
+
"eslint-plugin-import": "^2.25.2",
|
|
82
|
+
"eslint-plugin-jest": "^25.2.2",
|
|
83
|
+
"eslint-plugin-jsdoc": "^32.2.0",
|
|
84
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
85
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
86
|
+
"eslint-plugin-react": "^7.26.1",
|
|
87
|
+
"generate-changelog": "^1.8.0",
|
|
88
|
+
"husky": "^7.0.4",
|
|
89
|
+
"lint-staged": "^11.2.6",
|
|
90
|
+
"prettier": "^2.4.1",
|
|
75
91
|
"storybook-addon-jsx": "^7.3.14"
|
|
92
|
+
},
|
|
93
|
+
"peerDependencies": {
|
|
94
|
+
"babel-loader": "8.1.0",
|
|
95
|
+
"react": "^17.0.2",
|
|
96
|
+
"react-dom": "^17.0.2",
|
|
97
|
+
"react-scripts": "4.0.3",
|
|
98
|
+
"web-vitals": "^1.1.2"
|
|
76
99
|
}
|
|
77
100
|
}
|
package/src/App.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { BmModal, BmButton
|
|
3
|
-
import {
|
|
4
|
-
import beem from './lib/assets/beem.jpeg';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { GlobalStyle, BmModal, BmButton } from './lib/components';
|
|
3
|
+
import { BmCheckboxToggle } from './lib/components/Checkbox/checkboxToggler';
|
|
5
4
|
|
|
6
5
|
const Chat = () => {
|
|
6
|
+
const [checked, setChecked] = useState(false);
|
|
7
7
|
const [showModal, setShowModal] = useState(false);
|
|
8
|
-
|
|
9
8
|
return (
|
|
10
9
|
<>
|
|
11
10
|
<GlobalStyle />
|
|
@@ -20,14 +19,18 @@ const Chat = () => {
|
|
|
20
19
|
<h5>This modal has a sub heading</h5>
|
|
21
20
|
</BmModal.SubHeader>
|
|
22
21
|
<BmModal.Body>
|
|
23
|
-
<
|
|
22
|
+
<BmCheckboxToggle
|
|
23
|
+
checked={checked}
|
|
24
|
+
onChange={() => setChecked(!checked)}
|
|
25
|
+
disabled
|
|
26
|
+
label={<h3>Field Label</h3>}
|
|
27
|
+
/>
|
|
24
28
|
<p>This is a body</p>
|
|
25
29
|
</BmModal.Body>
|
|
26
30
|
<BmModal.Footer>
|
|
27
31
|
<p>This is a footer</p>
|
|
28
32
|
</BmModal.Footer>
|
|
29
33
|
</BmModal>
|
|
30
|
-
<BmProfileIcon img={beem} channel="instagram" />
|
|
31
34
|
</>
|
|
32
35
|
);
|
|
33
36
|
};
|
package/src/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import ReactDOM from
|
|
3
|
-
import App from
|
|
4
|
-
import reportWebVitals from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import App from './App';
|
|
4
|
+
import reportWebVitals from './reportWebVitals';
|
|
5
|
+
|
|
5
6
|
ReactDOM.render(
|
|
6
7
|
<React.StrictMode>
|
|
7
8
|
<App />
|
|
8
9
|
</React.StrictMode>,
|
|
9
|
-
document.getElementById(
|
|
10
|
+
document.getElementById('root')
|
|
10
11
|
);
|
|
11
12
|
|
|
12
|
-
// If you want to start measuring performance in your app, pass a function
|
|
13
|
-
// to log results (for example: reportWebVitals(console.log))
|
|
14
|
-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
15
13
|
reportWebVitals();
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { KeyboardArrowDown, KeyboardArrowUp } from
|
|
1
|
+
/* eslint-disable react/display-name */
|
|
2
|
+
/* eslint-disable react/destructuring-assignment */
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { KeyboardArrowDown, KeyboardArrowUp } from '@material-ui/icons';
|
|
7
|
+
import { BmPrimaryWhite } from '../colors';
|
|
8
|
+
import { BmIcons } from '../iconStyles';
|
|
7
9
|
|
|
8
10
|
const { Provider, Consumer } = React.createContext({});
|
|
9
11
|
|
|
10
12
|
const Dropdown = (value, rest) => {
|
|
11
|
-
if (value.expandIcon && value.expandIcon ===
|
|
13
|
+
if (value.expandIcon && value.expandIcon === 'none') {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
if (!value.expandIcon) {
|
|
@@ -18,7 +20,7 @@ const Dropdown = (value, rest) => {
|
|
|
18
20
|
<BmIcons icon={<KeyboardArrowDown />} {...rest} />
|
|
19
21
|
);
|
|
20
22
|
}
|
|
21
|
-
if (value.expandIcon && value.expandIcon !==
|
|
23
|
+
if (value.expandIcon && value.expandIcon !== 'none') {
|
|
22
24
|
return <BmIcons icon={value.expandIcon} />;
|
|
23
25
|
}
|
|
24
26
|
};
|
|
@@ -44,12 +46,28 @@ const BmAccordionWrapper = styled.div`
|
|
|
44
46
|
flex-direction: column;
|
|
45
47
|
`;
|
|
46
48
|
|
|
47
|
-
const BmAccordion = ({
|
|
48
|
-
|
|
49
|
+
const BmAccordion = ({
|
|
50
|
+
children,
|
|
51
|
+
disabled,
|
|
52
|
+
expandIcon,
|
|
53
|
+
Open,
|
|
54
|
+
expandIconPosition,
|
|
55
|
+
...rest
|
|
56
|
+
}) => {
|
|
57
|
+
const [toggle, setToggle] = useState(!!Open);
|
|
49
58
|
|
|
50
59
|
return (
|
|
51
60
|
<BmAccordionWrapper>
|
|
52
|
-
<Provider
|
|
61
|
+
<Provider
|
|
62
|
+
value={{
|
|
63
|
+
toggle,
|
|
64
|
+
setToggle,
|
|
65
|
+
disabled,
|
|
66
|
+
expandIcon,
|
|
67
|
+
expandIconPosition,
|
|
68
|
+
...rest,
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
53
71
|
{children}
|
|
54
72
|
</Provider>
|
|
55
73
|
</BmAccordionWrapper>
|
|
@@ -74,12 +92,12 @@ BmAccordion.Title = ({
|
|
|
74
92
|
: value.setToggle(false)
|
|
75
93
|
}
|
|
76
94
|
>
|
|
77
|
-
{value.expandIconPosition ===
|
|
78
|
-
|
|
95
|
+
{value.expandIconPosition === 'left' ||
|
|
96
|
+
(value.expandIconPosition === undefined && Dropdown(value, rest))}
|
|
79
97
|
{leadingIcon && <BmIcons icon={leadingIcon} size={size} />}
|
|
80
98
|
<BmAccordionDetails>{children}</BmAccordionDetails>
|
|
81
99
|
{trailingIcon && <BmIcons icon={trailingIcon} size={size} />}
|
|
82
|
-
{value.expandIconPosition ===
|
|
100
|
+
{value.expandIconPosition === 'right' && Dropdown(value, rest)}
|
|
83
101
|
</BmAccordionMenu>
|
|
84
102
|
)}
|
|
85
103
|
</Consumer>
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { text, boolean, select } from '@storybook/addon-knobs';
|
|
4
|
+
import { Favorite, Home } from '@material-ui/icons';
|
|
5
|
+
import BmAccordion from './Accordion';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
component: BmAccordion,
|
|
9
9
|
subcomponents: BmAccordion.Title,
|
|
10
|
-
title:
|
|
10
|
+
title: 'components/Accordion',
|
|
11
11
|
argTypes: {
|
|
12
12
|
size: {
|
|
13
|
-
options: [
|
|
14
|
-
control: { type:
|
|
15
|
-
description:
|
|
16
|
-
defaultValue: { summary:
|
|
13
|
+
options: ['small', 'medium', 'large'],
|
|
14
|
+
control: { type: 'select' },
|
|
15
|
+
description: 'Size of the icons',
|
|
16
|
+
defaultValue: { summary: 'large' },
|
|
17
17
|
},
|
|
18
18
|
disabled: {
|
|
19
|
-
description:
|
|
19
|
+
description: 'Optional',
|
|
20
20
|
defaultValue: { summary: false },
|
|
21
|
-
control: { type:
|
|
21
|
+
control: { type: 'boolean' },
|
|
22
22
|
},
|
|
23
23
|
Open: {
|
|
24
|
-
description:
|
|
24
|
+
description: 'Accordion body will be open initially',
|
|
25
25
|
defaultValue: { summary: false },
|
|
26
|
-
control: { type:
|
|
26
|
+
control: { type: 'boolean' },
|
|
27
27
|
},
|
|
28
28
|
children: {
|
|
29
|
-
description:
|
|
29
|
+
description: 'Accordion Title Text',
|
|
30
30
|
defaultValue: { summary: undefined },
|
|
31
31
|
},
|
|
32
32
|
expandIcon: {
|
|
@@ -34,51 +34,51 @@ export default {
|
|
|
34
34
|
defaultValue: { summary: undefined },
|
|
35
35
|
},
|
|
36
36
|
expandIconPosition: {
|
|
37
|
-
options: [
|
|
38
|
-
control: { type:
|
|
39
|
-
description:
|
|
40
|
-
defaultValue: { summary:
|
|
37
|
+
options: ['left', 'right'],
|
|
38
|
+
control: { type: 'select' },
|
|
39
|
+
description: 'Position of the expand Icon',
|
|
40
|
+
defaultValue: { summary: 'left' },
|
|
41
41
|
},
|
|
42
42
|
leadingIcon: {
|
|
43
|
-
description:
|
|
43
|
+
description: 'Material-UI icon(optional)',
|
|
44
44
|
defaultValue: { summary: undefined },
|
|
45
45
|
},
|
|
46
46
|
trailingIcon: {
|
|
47
|
-
description:
|
|
47
|
+
description: 'Material-UI icon(optional)',
|
|
48
48
|
defaultValue: { summary: undefined },
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
const optionSize = {
|
|
54
|
-
small:
|
|
55
|
-
medium:
|
|
56
|
-
large:
|
|
54
|
+
small: 'small',
|
|
55
|
+
medium: 'medium',
|
|
56
|
+
large: 'large',
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const optionExpandIcon = {
|
|
60
|
-
left:
|
|
61
|
-
right:
|
|
60
|
+
left: 'left',
|
|
61
|
+
right: 'medium',
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
export const Accordion = () => {
|
|
65
65
|
return (
|
|
66
66
|
<div>
|
|
67
67
|
<BmAccordion
|
|
68
|
-
disabled={boolean(
|
|
69
|
-
Open={boolean(
|
|
68
|
+
disabled={boolean('disabled', false)}
|
|
69
|
+
Open={boolean('disabled', false)}
|
|
70
70
|
>
|
|
71
71
|
<BmAccordion.Title
|
|
72
72
|
leadingIcon={<Home />}
|
|
73
73
|
trailingIcon={<Favorite />}
|
|
74
|
-
size={select(
|
|
74
|
+
size={select('size', optionSize, 'large')}
|
|
75
75
|
expandIconPosition={select(
|
|
76
|
-
|
|
76
|
+
'expandIconPosition',
|
|
77
77
|
optionExpandIcon,
|
|
78
|
-
|
|
78
|
+
'left'
|
|
79
79
|
)}
|
|
80
80
|
>
|
|
81
|
-
<h3>{text(
|
|
81
|
+
<h3>{text('children', 'Accordion')}</h3>
|
|
82
82
|
</BmAccordion.Title>
|
|
83
83
|
<BmAccordion.Body>Accordion Body</BmAccordion.Body>
|
|
84
84
|
</BmAccordion>
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { Person } from
|
|
2
|
-
import React from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import styled from
|
|
5
|
-
import { BmGrey100, BmPrimaryBlue } from "../colors";
|
|
6
|
-
import { BmAvatarIcon } from "../iconStyles";
|
|
1
|
+
import { Person } from '@material-ui/icons';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styled from 'styled-components';
|
|
7
5
|
import SmartToyIcon from '@mui/icons-material/SmartToy';
|
|
6
|
+
import { BmGrey100, BmPrimaryBlue } from '../colors';
|
|
7
|
+
import { BmAvatarIcon } from '../iconStyles';
|
|
8
8
|
|
|
9
9
|
export const BmAvatarWrapper = styled.div`
|
|
10
10
|
display: flex;
|
|
11
11
|
align-items: center;
|
|
12
12
|
justify-content: center;
|
|
13
13
|
height: ${({ size }) => {
|
|
14
|
-
if (size ===
|
|
15
|
-
if (size ===
|
|
16
|
-
if (size ===
|
|
17
|
-
if (size ===
|
|
18
|
-
if (!size) return
|
|
14
|
+
if (size === 'large') return '3.429rem';
|
|
15
|
+
if (size === 'medium') return '2.286rem';
|
|
16
|
+
if (size === 'small') return '1.714rem';
|
|
17
|
+
if (size === 'xsmall') return '1.429rem';
|
|
18
|
+
if (!size) return '3.429rem';
|
|
19
19
|
return size;
|
|
20
20
|
}};
|
|
21
21
|
width: ${({ size }) => {
|
|
22
|
-
if (size ===
|
|
23
|
-
if (size ===
|
|
24
|
-
if (size ===
|
|
25
|
-
if (size ===
|
|
26
|
-
if (!size) return
|
|
22
|
+
if (size === 'large') return '3.429rem';
|
|
23
|
+
if (size === 'medium') return '2.286rem';
|
|
24
|
+
if (size === 'small') return '1.714rem';
|
|
25
|
+
if (size === 'xsmall') return '1.429rem';
|
|
26
|
+
if (!size) return '3.429rem';
|
|
27
27
|
return size;
|
|
28
28
|
}};
|
|
29
29
|
background: ${({ user }) => {
|
|
30
|
-
if (user ===
|
|
31
|
-
if (user ===
|
|
30
|
+
if (user === 'chatbot') return `${BmPrimaryBlue}`;
|
|
31
|
+
if (user === 'employee') return `${BmPrimaryBlue}`;
|
|
32
32
|
return `${BmGrey100}`;
|
|
33
33
|
}};
|
|
34
34
|
border-radius: ${({ type }) => {
|
|
35
|
-
if (type ===
|
|
36
|
-
if (type ===
|
|
37
|
-
return
|
|
35
|
+
if (type === 'circle') return '7.143rem';
|
|
36
|
+
if (type === 'square') return '0.179rem';
|
|
37
|
+
return '7.143rem';
|
|
38
38
|
}};
|
|
39
39
|
border: 0.071rem solid
|
|
40
40
|
${({ user }) => {
|
|
41
|
-
if (user ===
|
|
42
|
-
if (user ===
|
|
41
|
+
if (user === 'chatbot') return `${BmPrimaryBlue}`;
|
|
42
|
+
if (user === 'employee') return `${BmPrimaryBlue}`;
|
|
43
43
|
return `${BmGrey100}`;
|
|
44
44
|
}};
|
|
45
45
|
`;
|
|
@@ -48,13 +48,18 @@ const BmAvatar = (props) => {
|
|
|
48
48
|
const { user, size, color, ...rest } = props;
|
|
49
49
|
return (
|
|
50
50
|
<BmAvatarWrapper user={user} size={size} {...rest}>
|
|
51
|
-
{user ===
|
|
51
|
+
{user === 'employee' && (
|
|
52
52
|
<BmAvatarIcon icon={<Person />} size={size} color={color} {...rest} />
|
|
53
53
|
)}
|
|
54
|
-
{user ===
|
|
55
|
-
<BmAvatarIcon
|
|
54
|
+
{user === 'chatbot' && (
|
|
55
|
+
<BmAvatarIcon
|
|
56
|
+
icon={<SmartToyIcon />}
|
|
57
|
+
size={size}
|
|
58
|
+
color={color}
|
|
59
|
+
{...rest}
|
|
60
|
+
/>
|
|
56
61
|
)}
|
|
57
|
-
{user !==
|
|
62
|
+
{user !== 'chatbot' && user !== 'employee' && user !== 'default' && (
|
|
58
63
|
<BmAvatarIcon icon={user} size={size} color={color} {...rest} />
|
|
59
64
|
)}
|
|
60
65
|
</BmAvatarWrapper>
|
|
@@ -68,4 +73,4 @@ BmAvatar.propTypes = {
|
|
|
68
73
|
user: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
69
74
|
};
|
|
70
75
|
|
|
71
|
-
export default BmAvatar;
|
|
76
|
+
export default BmAvatar;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Home } from '@material-ui/icons';
|
|
4
|
+
import BmAvatar from './avatars';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: BmAvatar,
|
|
8
|
-
title:
|
|
8
|
+
title: 'components/Avatars',
|
|
9
9
|
argTypes: {
|
|
10
10
|
size: {
|
|
11
|
-
options: [
|
|
12
|
-
control: { type:
|
|
13
|
-
description:
|
|
14
|
-
defaultValue: { summary:
|
|
11
|
+
options: ['xsmall', 'small', 'medium', 'large'],
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
description: 'Size of the Avatar',
|
|
14
|
+
defaultValue: { summary: 'large' },
|
|
15
15
|
},
|
|
16
16
|
type: {
|
|
17
|
-
options: [
|
|
18
|
-
control: { type:
|
|
19
|
-
description:
|
|
20
|
-
defaultValue: { summary:
|
|
17
|
+
options: ['circle', 'square'],
|
|
18
|
+
control: { type: 'select' },
|
|
19
|
+
description: 'Shape of the Avatar',
|
|
20
|
+
defaultValue: { summary: 'circle' },
|
|
21
21
|
},
|
|
22
22
|
user: {
|
|
23
23
|
description:
|
|
@@ -31,15 +31,15 @@ const MainAvatar = (args) => <BmAvatar {...args} />;
|
|
|
31
31
|
|
|
32
32
|
export const Avatar = MainAvatar.bind({});
|
|
33
33
|
Avatar.args = {
|
|
34
|
-
user:
|
|
35
|
-
size:
|
|
36
|
-
type:
|
|
34
|
+
user: 'chatbot',
|
|
35
|
+
size: 'large',
|
|
36
|
+
type: 'circle',
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const CustomAvatar = MainAvatar.bind({});
|
|
40
40
|
CustomAvatar.args = {
|
|
41
41
|
user: <Home />,
|
|
42
|
-
size:
|
|
43
|
-
type:
|
|
44
|
-
color:
|
|
42
|
+
size: 'large',
|
|
43
|
+
type: 'square',
|
|
44
|
+
color: '#000000',
|
|
45
45
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from
|
|
3
|
-
import BmBanner from
|
|
4
|
-
import { BmButton, BmTag } from
|
|
5
|
-
import { BmPrimaryBlue, BmSecondaryYellow } from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import BmBanner from './bannerCards';
|
|
4
|
+
import { BmButton, BmTag } from '..';
|
|
5
|
+
import { BmPrimaryBlue, BmSecondaryYellow } from '../colors';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
component: BmBanner,
|
|
9
|
-
title:
|
|
9
|
+
title: 'components/Banner',
|
|
10
10
|
argTypes: {
|
|
11
11
|
border: {
|
|
12
|
-
options: [
|
|
13
|
-
control: { type:
|
|
14
|
-
description:
|
|
15
|
-
defaultValue: { summary:
|
|
12
|
+
options: ['dashed', 'solid'],
|
|
13
|
+
control: { type: 'select' },
|
|
14
|
+
description: 'Banner border',
|
|
15
|
+
defaultValue: { summary: 'none' },
|
|
16
16
|
},
|
|
17
17
|
bannerBg: {
|
|
18
18
|
description:
|
|
19
19
|
"Banner Background Color, Can be set as 'default', or custom color",
|
|
20
20
|
},
|
|
21
21
|
content: {
|
|
22
|
-
options: [
|
|
23
|
-
control: { type:
|
|
22
|
+
options: ['left', 'center', 'right'],
|
|
23
|
+
control: { type: 'select' },
|
|
24
24
|
description:
|
|
25
|
-
|
|
25
|
+
'Aligning content of banner, will not work if closeButton is present',
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
};
|
|
@@ -42,8 +42,8 @@ export const SampleBanner = () => {
|
|
|
42
42
|
export const AnnouncementBanner = () => {
|
|
43
43
|
return (
|
|
44
44
|
<BmBanner bannerBg={`${BmPrimaryBlue}`} closeButton>
|
|
45
|
-
<h3 style={{ color:
|
|
46
|
-
<p style={{ color:
|
|
45
|
+
<h3 style={{ color: 'white' }}>Special Announcement Title</h3>
|
|
46
|
+
<p style={{ color: 'white' }}>Message Text</p>
|
|
47
47
|
<div>
|
|
48
48
|
<BmButton variant="neutral" size="small">
|
|
49
49
|
Label
|
|
@@ -59,8 +59,8 @@ export const FeatureBanner = () => {
|
|
|
59
59
|
<BmTag variant="light">
|
|
60
60
|
<p>New</p>
|
|
61
61
|
</BmTag>
|
|
62
|
-
<h3 style={{ color:
|
|
63
|
-
<p style={{ color:
|
|
62
|
+
<h3 style={{ color: 'white' }}>New Feature Title</h3>
|
|
63
|
+
<p style={{ color: 'white' }}>Message Text</p>
|
|
64
64
|
<div>
|
|
65
65
|
<BmButton size="small">Label</BmButton>
|
|
66
66
|
</div>
|
|
@@ -77,6 +77,5 @@ export const GenericBanner = () => {
|
|
|
77
77
|
<BmButton size="small">Label</BmButton>
|
|
78
78
|
</div>
|
|
79
79
|
</BmBanner>
|
|
80
|
-
|
|
81
80
|
);
|
|
82
81
|
};
|