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
|
@@ -1,47 +1,46 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import { Delete, Favorite, Person } from
|
|
3
|
-
import React from
|
|
4
|
-
import {
|
|
5
|
-
import { BmPill } from "./pills";
|
|
2
|
+
import { Delete, Favorite, Person } from '@material-ui/icons';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { BmPill } from './pills';
|
|
6
5
|
|
|
7
6
|
export default {
|
|
8
7
|
component: BmPill,
|
|
9
|
-
title:
|
|
8
|
+
title: 'components/Pills',
|
|
10
9
|
argTypes: {
|
|
11
10
|
icon: {
|
|
12
|
-
description:
|
|
11
|
+
description: 'Material-UI icon(optional)',
|
|
13
12
|
defaultValue: { summary: undefined },
|
|
14
13
|
},
|
|
15
14
|
avatarIcon: {
|
|
16
|
-
description:
|
|
15
|
+
description: 'Material-UI icon(optional)',
|
|
17
16
|
defaultValue: { summary: undefined },
|
|
18
17
|
},
|
|
19
18
|
size: {
|
|
20
|
-
options: [
|
|
21
|
-
control: { type:
|
|
22
|
-
description:
|
|
23
|
-
defaultValue: { summary:
|
|
19
|
+
options: ['xsmall', 'small', 'medium', 'large', 'xlarge'],
|
|
20
|
+
control: { type: 'select' },
|
|
21
|
+
description: 'Size of the Icon (Can also be predefined e.g. 10px)',
|
|
22
|
+
defaultValue: { summary: 'xsmall' },
|
|
24
23
|
},
|
|
25
24
|
avatarSize: {
|
|
26
|
-
options: [
|
|
27
|
-
control: { type:
|
|
28
|
-
description:
|
|
29
|
-
defaultValue: { summary:
|
|
25
|
+
options: ['xsmall', 'small', 'medium', 'large', 'xlarge'],
|
|
26
|
+
control: { type: 'select' },
|
|
27
|
+
description: 'Size of the AvatarIcon (Can also be predefined e.g. 10px)',
|
|
28
|
+
defaultValue: { summary: 'xsmall' },
|
|
30
29
|
},
|
|
31
30
|
label: {
|
|
32
|
-
description:
|
|
33
|
-
defaultValue: { summary:
|
|
31
|
+
description: 'Pill label in uppercase',
|
|
32
|
+
defaultValue: { summary: 'undefined' },
|
|
34
33
|
},
|
|
35
34
|
color: {
|
|
36
|
-
description:
|
|
37
|
-
defaultValue: { summary:
|
|
35
|
+
description: 'Color of Pill ',
|
|
36
|
+
defaultValue: { summary: 'black' },
|
|
38
37
|
},
|
|
39
38
|
onDelete: {
|
|
40
|
-
description:
|
|
39
|
+
description: 'Handles Deleting Pill',
|
|
41
40
|
defaultValue: { summary: undefined },
|
|
42
41
|
},
|
|
43
42
|
deleteIcon: {
|
|
44
|
-
description:
|
|
43
|
+
description: 'Material-UI icon (Used only when OnDelete is present)',
|
|
45
44
|
defaultValue: { summary: undefined },
|
|
46
45
|
},
|
|
47
46
|
},
|
|
@@ -52,7 +51,7 @@ const MainPill = (args) => <BmPill {...args} />;
|
|
|
52
51
|
export const BasicPill = MainPill.bind({});
|
|
53
52
|
BasicPill.args = {
|
|
54
53
|
icon: <Favorite />,
|
|
55
|
-
label:
|
|
54
|
+
label: 'label',
|
|
56
55
|
color: undefined,
|
|
57
56
|
onDelete: undefined,
|
|
58
57
|
deleteIcon: undefined,
|
|
@@ -64,7 +63,7 @@ BasicPill.args = {
|
|
|
64
63
|
export const CustomPill = MainPill.bind({});
|
|
65
64
|
CustomPill.args = {
|
|
66
65
|
icon: undefined,
|
|
67
|
-
label:
|
|
66
|
+
label: 'label',
|
|
68
67
|
color: undefined,
|
|
69
68
|
onDelete: true,
|
|
70
69
|
deleteIcon: <Delete />,
|
|
@@ -5,74 +5,72 @@ import wa from '../../assets/wa.png';
|
|
|
5
5
|
import fb from '../../assets/fb.png';
|
|
6
6
|
import insta from '../../assets/insta.png';
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
const handleSize = (size) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
if (size) {
|
|
10
|
+
if (size === 'large') return '3.429rem';
|
|
11
|
+
if (size === 'medium') return '2.286rem';
|
|
12
|
+
if (size === 'small') return '1.714rem';
|
|
13
|
+
if (size === 'xsmall') return '1.429rem';
|
|
14
|
+
}
|
|
15
|
+
return '3.429rem';
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
const position = (size) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
if (size) {
|
|
20
|
+
if (size === 'large') return '2.286rem';
|
|
21
|
+
if (size === 'medium') return '1.5rem';
|
|
22
|
+
if (size === 'small') return '1rem';
|
|
23
|
+
if (size === 'xsmall') return '0.714rem';
|
|
24
|
+
}
|
|
25
|
+
return '2.286rem';
|
|
27
26
|
};
|
|
28
27
|
|
|
29
28
|
const ProfileImg = styled.img`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
height: ${(props) => handleSize(props.size)};
|
|
30
|
+
width: ${(props) => handleSize(props.size)};
|
|
31
|
+
object-fit: contain;
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
display: flex;
|
|
35
34
|
`;
|
|
36
35
|
|
|
37
36
|
const Profile = styled.div`
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
height: ${(props) => handleSize(props.size)};
|
|
38
|
+
width: ${(props) => handleSize(props.size)};
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
border: 1px solid ${BmBgLightBlue};
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
position: relative;
|
|
45
|
+
background: ${BmSecondaryBlue12};
|
|
47
46
|
`;
|
|
48
47
|
|
|
49
48
|
const Content = styled.div`
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
position: absolute;
|
|
54
53
|
`;
|
|
55
54
|
|
|
56
|
-
|
|
57
55
|
const Dot = styled.img`
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
position: absolute;
|
|
57
|
+
left: ${(props) => position(props.size)};
|
|
58
|
+
bottom: 0rem;
|
|
59
|
+
object-fit: contain;
|
|
60
|
+
height: 1rem;
|
|
61
|
+
width: 1rem;
|
|
64
62
|
`;
|
|
65
63
|
|
|
66
64
|
export const BmProfileIcon = ({ img, content, channel, size, ...rest }) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
<Profile size={size} {...rest}>
|
|
68
|
+
{content && !img && <Content>{content}</Content>}
|
|
69
|
+
{img && !content && <ProfileImg src={img} />}
|
|
70
|
+
{channel && channel === 'whatsapp' && <Dot size={size} src={wa} />}
|
|
71
|
+
{channel && channel === 'facebook' && <Dot size={size} src={fb} />}
|
|
72
|
+
{channel && channel === 'instagram' && <Dot size={size} src={insta} />}
|
|
73
|
+
</Profile>
|
|
74
|
+
</>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from
|
|
3
|
-
import { BmProfileIcon } from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BmProfileIcon } from './ProfileIcon';
|
|
4
4
|
import beem from '../../assets/beem.jpeg';
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
export default {
|
|
8
7
|
component: BmProfileIcon,
|
|
9
|
-
title:
|
|
8
|
+
title: 'components/ProfileIcon',
|
|
10
9
|
argTypes: {
|
|
11
10
|
size: {
|
|
12
|
-
options: [
|
|
13
|
-
control: { type:
|
|
14
|
-
description:
|
|
15
|
-
defaultValue: { summary:
|
|
11
|
+
options: ['xsmall', 'small', 'medium', 'large'],
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
description: 'Size of the profile',
|
|
14
|
+
defaultValue: { summary: 'large' },
|
|
16
15
|
},
|
|
17
16
|
img: {
|
|
18
|
-
description:
|
|
17
|
+
description:
|
|
18
|
+
'Image to be displayed (will not be displayed if content is present)',
|
|
19
19
|
defaultValue: { summary: undefined },
|
|
20
20
|
},
|
|
21
21
|
content: {
|
|
22
|
-
description:
|
|
22
|
+
description:
|
|
23
|
+
'Content to be displayed (will not be displayed if image is present)',
|
|
23
24
|
defaultValue: { summary: undefined },
|
|
24
25
|
},
|
|
25
26
|
channel: {
|
|
26
|
-
options: [
|
|
27
|
-
control: { type:
|
|
28
|
-
description:
|
|
27
|
+
options: ['whatsapp', 'instagram', 'facebook'],
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
description: 'Profile badge',
|
|
29
30
|
defaultValue: { summary: undefined },
|
|
30
31
|
},
|
|
31
32
|
},
|
|
@@ -35,23 +36,22 @@ const MainProfileIcon = (args) => <BmProfileIcon {...args} />;
|
|
|
35
36
|
|
|
36
37
|
export const Sample = MainProfileIcon.bind({});
|
|
37
38
|
Sample.args = {
|
|
38
|
-
channel:
|
|
39
|
-
size:
|
|
39
|
+
channel: 'whatsapp',
|
|
40
|
+
size: 'large',
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
export const ImageProfile = MainProfileIcon.bind({});
|
|
43
44
|
ImageProfile.args = {
|
|
44
|
-
channel:
|
|
45
|
-
size:
|
|
45
|
+
channel: 'whatsapp',
|
|
46
|
+
size: 'large',
|
|
46
47
|
img: beem,
|
|
47
|
-
content: undefined
|
|
48
|
+
content: undefined,
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
export const ContentProfile = MainProfileIcon.bind({});
|
|
51
52
|
ContentProfile.args = {
|
|
52
|
-
channel:
|
|
53
|
-
size:
|
|
53
|
+
channel: 'whatsapp',
|
|
54
|
+
size: 'large',
|
|
54
55
|
content: <h4>BC</h4>,
|
|
55
|
-
img: undefined
|
|
56
|
+
img: undefined,
|
|
56
57
|
};
|
|
57
|
-
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import styled from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
3
|
import Proptypes from 'prop-types';
|
|
4
|
-
import { BmGrey100, BmPrimaryBlue } from
|
|
4
|
+
import { BmGrey100, BmPrimaryBlue } from '../colors';
|
|
5
5
|
|
|
6
6
|
const Container = styled.div`
|
|
7
7
|
height: 0.75rem;
|
|
@@ -36,8 +36,7 @@ export const BmProgressBar = (props) => {
|
|
|
36
36
|
);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
|
|
40
39
|
BmProgressBar.propTypes = {
|
|
41
40
|
value: Proptypes.string.isRequired,
|
|
42
41
|
color: Proptypes.string,
|
|
43
|
-
}
|
|
42
|
+
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from
|
|
3
|
-
import { BmProgressBar } from
|
|
4
|
-
import { Home } from "@material-ui/icons";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BmProgressBar } from './progressbar';
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
component: BmProgressBar,
|
|
8
|
-
title:
|
|
7
|
+
title: 'components/ProgressBar',
|
|
9
8
|
argTypes: {
|
|
10
9
|
value: {
|
|
11
|
-
control: { type:
|
|
12
|
-
description:
|
|
10
|
+
control: { type: 'text' },
|
|
11
|
+
description: 'Progress value',
|
|
13
12
|
},
|
|
14
13
|
color: {
|
|
15
|
-
control: { type:
|
|
16
|
-
description:
|
|
14
|
+
control: { type: 'text' },
|
|
15
|
+
description: 'Color of the progress bar',
|
|
17
16
|
},
|
|
18
17
|
},
|
|
19
18
|
};
|
|
@@ -22,5 +21,5 @@ const MainProgressBar = (args) => <BmProgressBar {...args} />;
|
|
|
22
21
|
|
|
23
22
|
export const ProgressBar = MainProgressBar.bind({});
|
|
24
23
|
ProgressBar.args = {
|
|
25
|
-
value:
|
|
24
|
+
value: '50',
|
|
26
25
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
/* eslint-disable no-shadow */
|
|
2
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styled from 'styled-components';
|
|
4
5
|
import {
|
|
5
6
|
BmGrey100,
|
|
6
7
|
BmPrimaryBlue,
|
|
7
8
|
BmSecondaryDarkGreen,
|
|
8
9
|
BmPrimaryGold,
|
|
9
10
|
BmSecondaryRed,
|
|
10
|
-
} from
|
|
11
|
+
} from '../colors';
|
|
11
12
|
|
|
12
13
|
const small = 1.429;
|
|
13
14
|
const medium = 1.714;
|
|
@@ -16,18 +17,18 @@ const large = 2.286;
|
|
|
16
17
|
let center;
|
|
17
18
|
let radius;
|
|
18
19
|
let circumference;
|
|
19
|
-
|
|
20
|
+
const strokeWidth = 5;
|
|
20
21
|
let initialSize;
|
|
21
22
|
|
|
22
23
|
const measurement = (size) => {
|
|
23
24
|
let initialSize = size || large * 14;
|
|
24
|
-
if (size ===
|
|
25
|
+
if (size === 'small') {
|
|
25
26
|
initialSize = small * 14;
|
|
26
27
|
}
|
|
27
|
-
if (size ===
|
|
28
|
+
if (size === 'medium') {
|
|
28
29
|
initialSize = medium * 14;
|
|
29
30
|
}
|
|
30
|
-
if (size ===
|
|
31
|
+
if (size === 'large') {
|
|
31
32
|
initialSize = large * 14;
|
|
32
33
|
}
|
|
33
34
|
center = initialSize / 2;
|
|
@@ -38,17 +39,17 @@ const measurement = (size) => {
|
|
|
38
39
|
const ProgressRingWrapper = styled.svg`
|
|
39
40
|
display: flex;
|
|
40
41
|
width: ${({ size }) => {
|
|
41
|
-
if (size ===
|
|
42
|
-
if (size ===
|
|
43
|
-
if (size ===
|
|
44
|
-
if (!size) return
|
|
42
|
+
if (size === 'small') return '1.429rem';
|
|
43
|
+
if (size === 'medium') return '1.714rem';
|
|
44
|
+
if (size === 'large') return '2.286rem';
|
|
45
|
+
if (!size) return '2.286rem';
|
|
45
46
|
return `${size}px`;
|
|
46
47
|
}};
|
|
47
48
|
height: ${({ size }) => {
|
|
48
|
-
if (size ===
|
|
49
|
-
if (size ===
|
|
50
|
-
if (size ===
|
|
51
|
-
if (!size) return
|
|
49
|
+
if (size === 'small') return '1.429rem';
|
|
50
|
+
if (size === 'medium') return '1.714rem';
|
|
51
|
+
if (size === 'large') return '2.286rem';
|
|
52
|
+
if (!size) return '2.286rem';
|
|
52
53
|
return `${size}px`;
|
|
53
54
|
}};
|
|
54
55
|
`;
|
|
@@ -61,10 +62,10 @@ const ProgressRingCircle2 = styled.circle`
|
|
|
61
62
|
fill: none;
|
|
62
63
|
stroke: ${({ variant, progress }) => {
|
|
63
64
|
if (progress) {
|
|
64
|
-
if (variant ===
|
|
65
|
-
if (variant ===
|
|
66
|
-
if (variant ===
|
|
67
|
-
if (variant ===
|
|
65
|
+
if (variant === 'primary') return `${BmPrimaryBlue}`;
|
|
66
|
+
if (variant === 'success') return `${BmSecondaryDarkGreen}`;
|
|
67
|
+
if (variant === 'warning') return `${BmPrimaryGold}`;
|
|
68
|
+
if (variant === 'danger') return `${BmSecondaryRed}`;
|
|
68
69
|
if (!variant) return `${BmPrimaryBlue}`;
|
|
69
70
|
}
|
|
70
71
|
if (!progress) return `${BmGrey100}`;
|
|
@@ -74,12 +75,12 @@ const ProgressRingCircle2 = styled.circle`
|
|
|
74
75
|
const Text = styled.text`
|
|
75
76
|
font-size: ${() => {
|
|
76
77
|
if (initialSize >= 50 && initialSize < 100) {
|
|
77
|
-
return
|
|
78
|
+
return '1rem';
|
|
78
79
|
}
|
|
79
80
|
if (initialSize >= 100) {
|
|
80
|
-
return
|
|
81
|
+
return '2rem';
|
|
81
82
|
}
|
|
82
|
-
return
|
|
83
|
+
return '0.5rem';
|
|
83
84
|
}};
|
|
84
85
|
text-anchor: middle;
|
|
85
86
|
fill: black;
|
|
@@ -101,7 +102,7 @@ const BmProgressRing = (props) => {
|
|
|
101
102
|
const progressOffset = ((100 - progress) / 100) * circumference;
|
|
102
103
|
setOffset(progressOffset);
|
|
103
104
|
|
|
104
|
-
circleRef.current.style =
|
|
105
|
+
circleRef.current.style = 'transition: stroke-dashoffset 850ms ease-in-out';
|
|
105
106
|
}, [setOffset, progress, offset]);
|
|
106
107
|
|
|
107
108
|
return (
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from
|
|
3
|
-
import BmProgressRing from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import BmProgressRing from './progressRing';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
component: BmProgressRing,
|
|
7
|
-
title:
|
|
7
|
+
title: 'components/ProgressRing',
|
|
8
8
|
argTypes: {
|
|
9
9
|
size: {
|
|
10
|
-
options: [
|
|
11
|
-
control: { type:
|
|
12
|
-
description:
|
|
13
|
-
defaultValue: { summary:
|
|
10
|
+
options: ['small', 'medium', 'large'],
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
description: 'Size of the Progress Ring (Can also be predefined e.g. 50)',
|
|
13
|
+
defaultValue: { summary: 'large' },
|
|
14
14
|
},
|
|
15
15
|
progress: {
|
|
16
|
-
description:
|
|
16
|
+
description: 'Progress Indicator',
|
|
17
17
|
},
|
|
18
18
|
variant: {
|
|
19
|
-
options: [
|
|
20
|
-
control: { type:
|
|
21
|
-
description:
|
|
22
|
-
defaultValue: { summary:
|
|
19
|
+
options: ['primary', 'success', 'warning', 'danger'],
|
|
20
|
+
control: { type: 'select' },
|
|
21
|
+
description: 'Color of the Progress Ring',
|
|
22
|
+
defaultValue: { summary: 'xsmall' },
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
};
|
|
@@ -28,14 +28,14 @@ const MainProgressRing = (args) => <BmProgressRing {...args} />;
|
|
|
28
28
|
|
|
29
29
|
export const BasicProgressRing = MainProgressRing.bind({});
|
|
30
30
|
BasicProgressRing.args = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
progress: 30,
|
|
32
|
+
variant: 'success',
|
|
33
|
+
size: 'xlarge',
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const CustomProgressRing = MainProgressRing.bind({});
|
|
37
37
|
CustomProgressRing.args = {
|
|
38
38
|
progress: 50,
|
|
39
|
-
variant:
|
|
40
|
-
size:
|
|
41
|
-
|
|
39
|
+
variant: 'primary',
|
|
40
|
+
size: '40',
|
|
41
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import { Link } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { darken } from 'polished';
|
|
4
|
+
import { BmPrimaryBlue } from '../colors';
|
|
5
|
+
import { p } from '../text';
|
|
6
6
|
|
|
7
|
-
//TODO: To be fixed for hover states
|
|
7
|
+
// TODO: To be fixed for hover states
|
|
8
8
|
export const BmRouteLink = styled(Link)`
|
|
9
9
|
${p}
|
|
10
|
-
color: ${(props) =>
|
|
10
|
+
color: ${(props) =>
|
|
11
|
+
props.color ? props.color : `${BmPrimaryBlue} `} !important;
|
|
11
12
|
text-decoration: none;
|
|
12
13
|
&:hover,
|
|
13
14
|
&:focus,
|
|
@@ -16,6 +17,7 @@ export const BmRouteLink = styled(Link)`
|
|
|
16
17
|
&:before {
|
|
17
18
|
font-weight: normal;
|
|
18
19
|
}
|
|
19
|
-
color: ${(props) =>
|
|
20
|
+
color: ${(props) =>
|
|
21
|
+
darken(0.1, props.color ? props.color : `${BmPrimaryBlue}`)} !important;
|
|
20
22
|
}
|
|
21
23
|
`;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable import/no-anonymous-default-export */
|
|
2
|
-
import React from
|
|
3
|
-
import { BrowserRouter, Switch } from
|
|
4
|
-
import { BmRouteLink } from
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BrowserRouter, Switch } from 'react-router-dom';
|
|
4
|
+
import { BmRouteLink } from './link';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: BmRouteLink,
|
|
8
|
-
title:
|
|
8
|
+
title: 'components/RouteLink',
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export const SampleLink = () => {
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import styled from
|
|
1
|
+
import styled from 'styled-components';
|
|
2
2
|
|
|
3
3
|
export const ScrollbarWrapper = styled.div(() => ({
|
|
4
|
-
|
|
5
|
-
background:
|
|
6
|
-
maxHeight:
|
|
7
|
-
display:
|
|
8
|
-
width:
|
|
9
|
-
overflow:
|
|
10
|
-
height:
|
|
4
|
+
'::-webkit-scrollbar-thumb': {
|
|
5
|
+
background: 'blue',
|
|
6
|
+
maxHeight: '10px',
|
|
7
|
+
display: 'block',
|
|
8
|
+
width: '10em',
|
|
9
|
+
overflow: 'auto',
|
|
10
|
+
height: '2em',
|
|
11
11
|
},
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
14
|
export const Scrollbar = styled.div`
|
|
15
|
-
::-webkit-scrollbar {
|
|
15
|
+
::-webkit-scrollbar {
|
|
16
16
|
width: 0.714rem !important;
|
|
17
|
-
}
|
|
18
|
-
::-webkit-scrollbar-thumb {
|
|
19
|
-
background-color: #
|
|
20
|
-
}
|
|
17
|
+
}
|
|
18
|
+
::-webkit-scrollbar-thumb {
|
|
19
|
+
background-color: #e2e2e2;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
21
22
|
|
|
22
23
|
export const Content = styled.div(() => ({
|
|
23
|
-
direction:
|
|
24
|
+
direction: 'ltr', // if you want to show the scroll bar on the left
|
|
24
25
|
}));
|
|
25
26
|
|
|
26
27
|
export default ScrollbarWrapper;
|