groundfloor-react-ui 1.0.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/README.md +20 -0
- package/assets/fonts/Averta/Averta-Black.woff2 +0 -0
- package/assets/fonts/Averta/Averta-BlackItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Bold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-BoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraBold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraBoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraThin.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraThinItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Light.woff2 +0 -0
- package/assets/fonts/Averta/Averta-LightItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Regular.woff2 +0 -0
- package/assets/fonts/Averta/Averta-RegularItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-SemiBold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-SemiBoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Thin.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ThinItalic.woff2 +0 -0
- package/assets/fonts/Beauty/BeautyDemo.woff +0 -0
- package/assets/icons/app-logo.svg +3 -0
- package/assets/icons/arrow-down.svg +3 -0
- package/assets/icons/arrow-rotate.svg +1 -0
- package/assets/icons/arrow-up.svg +3 -0
- package/assets/icons/bell.svg +3 -0
- package/assets/icons/check.svg +3 -0
- package/assets/icons/checkmark.svg +3 -0
- package/assets/icons/chevron-down.svg +3 -0
- package/assets/icons/chevron-left.svg +3 -0
- package/assets/icons/chevron-right.svg +3 -0
- package/assets/icons/cloud-icon.svg +3 -0
- package/assets/icons/connection.svg +3 -0
- package/assets/icons/cross-icon.svg +3 -0
- package/assets/icons/door-internal-active.svg +1 -0
- package/assets/icons/edit-icon.svg +3 -0
- package/assets/icons/ellipses-horizontal.svg +3 -0
- package/assets/icons/ellipses.svg +3 -0
- package/assets/icons/email.svg +3 -0
- package/assets/icons/eye-hide-view.svg +1 -0
- package/assets/icons/eye-hide.svg +1 -0
- package/assets/icons/file-attach-white.svg +3 -0
- package/assets/icons/file-attach.svg +3 -0
- package/assets/icons/functional-equation-regular.svg +147 -0
- package/assets/icons/hamburger-menu.svg +3 -0
- package/assets/icons/heart.svg +18 -0
- package/assets/icons/image.svg +3 -0
- package/assets/icons/info.svg +3 -0
- package/assets/icons/jpg-icon.svg +3 -0
- package/assets/icons/magnifier.svg +3 -0
- package/assets/icons/menu-ellipse-two.svg +1 -0
- package/assets/icons/menu-ellipse.svg +53 -0
- package/assets/icons/pause-all.svg +1 -0
- package/assets/icons/pdf-icon.svg +3 -0
- package/assets/icons/pen-icon.svg +3 -0
- package/assets/icons/plus-outlined.svg +3 -0
- package/assets/icons/resume.svg +1 -0
- package/assets/icons/sign-icon.svg +3 -0
- package/assets/icons/star.svg +3 -0
- package/assets/icons/trash-icon.svg +59 -0
- package/assets/icons/triangle-down.svg +3 -0
- package/assets/icons/users.svg +11 -0
- package/assets/icons/view.svg +3 -0
- package/assets/icons/watcher.svg +3 -0
- package/assets/icons/zoom-in-white.svg +1 -0
- package/assets/styles/global.css +0 -0
- package/assets/styles/global.scss +0 -0
- package/components/Accordion/Accordion.js +114 -0
- package/components/Accordion/AccordionSB.js +168 -0
- package/components/Accordion/AccordionSBfooter.js +171 -0
- package/components/Accordion/index.js +4 -0
- package/components/ArrowBar/ArrowBar.js +293 -0
- package/components/ArrowBar/index.js +2 -0
- package/components/Avatar/Avatar.js +167 -0
- package/components/Avatar/AvatarSB.js +226 -0
- package/components/Avatar/AvatarSBfooter.js +226 -0
- package/components/Avatar/index.js +4 -0
- package/components/Banner/Banner.js +65 -0
- package/components/Banner/index.js +2 -0
- package/components/Breadcrumb/Breadcrumb.js +192 -0
- package/components/Breadcrumb/index.js +2 -0
- package/components/Button/PrimaryButton.js +125 -0
- package/components/Button/SecondaryButton.js +114 -0
- package/components/Button/TinyButton.js +94 -0
- package/components/Button/index.js +6 -0
- package/components/Cards/Card.js +48 -0
- package/components/Cards/CardRef.js +64 -0
- package/components/Cards/DocumentCard.js +221 -0
- package/components/Cards/index.js +5 -0
- package/components/Content/Content.js +51 -0
- package/components/Content/index.js +1 -0
- package/components/Divider/Divider.js +63 -0
- package/components/Divider/index.js +2 -0
- package/components/Drawer/Drawer.js +93 -0
- package/components/Drawer/index.js +2 -0
- package/components/ErrorBoundary/ErrorBoundary.js +44 -0
- package/components/ErrorBoundary/index.js +1 -0
- package/components/FilterChip/FilterChip.js +68 -0
- package/components/FilterChip/index.js +1 -0
- package/components/Footer/Footer.js +58 -0
- package/components/Footer/FooterContentLev3.js +96 -0
- package/components/Footer/index.js +2 -0
- package/components/Form/FormComponent.js +273 -0
- package/components/Form/HeaderComponent.js +39 -0
- package/components/Form/StyledComponent.js +323 -0
- package/components/Form/SubmitComponent.js +63 -0
- package/components/Form/index.js +4 -0
- package/components/GroupAvatars/GroupAvatars.js +143 -0
- package/components/GroupAvatars/index.js +1 -0
- package/components/GroupButtons/ButtonPopup.js +192 -0
- package/components/GroupButtons/GroupButtons.js +150 -0
- package/components/GroupButtons/GroupButtonsPopup.js +169 -0
- package/components/GroupButtons/index.js +3 -0
- package/components/GroupStatusCircle/GroupStatusCircle.js +135 -0
- package/components/GroupStatusCircle/index.js +1 -0
- package/components/Header/Header.js +58 -0
- package/components/Header/index.js +1 -0
- package/components/HyperLink/HyperLink.js +114 -0
- package/components/HyperLink/index.js +1 -0
- package/components/Icon/Icon.js +161 -0
- package/components/Icon/index.js +1 -0
- package/components/Images/Image.js +112 -0
- package/components/Images/index.js +2 -0
- package/components/Inputs/CheckBoxEditableInput.js +352 -0
- package/components/Inputs/CheckBoxInput.js +195 -0
- package/components/Inputs/CheckBoxInputMS.js +160 -0
- package/components/Inputs/DateSelect.js +411 -0
- package/components/Inputs/DropdownSelect.js +466 -0
- package/components/Inputs/DropzoneInput.js +335 -0
- package/components/Inputs/NumericInput.js +155 -0
- package/components/Inputs/RadioInput.js +205 -0
- package/components/Inputs/SearchInput.js +18 -0
- package/components/Inputs/Signature.js +278 -0
- package/components/Inputs/TextArea.js +196 -0
- package/components/Inputs/TextInput.js +182 -0
- package/components/Inputs/TextInputClicable.js +198 -0
- package/components/Inputs/TextInputClicableMS.js +255 -0
- package/components/Inputs/TimeInput.js +181 -0
- package/components/Inputs/ToggleSwitch.js +123 -0
- package/components/Inputs/index.js +13 -0
- package/components/Label/Label.js +48 -0
- package/components/Label/index.js +1 -0
- package/components/Loaders/Loader.js +179 -0
- package/components/Loaders/index.js +2 -0
- package/components/Modal/Modal.js +116 -0
- package/components/Modal/ModalComp.js +158 -0
- package/components/Modal/index.js +2 -0
- package/components/Overlay/Overlay.js +159 -0
- package/components/Overlay/index.js +1 -0
- package/components/Pagination/Pagination.js +83 -0
- package/components/Pagination/index.js +1 -0
- package/components/ProgressBar/ProgressBar.js +84 -0
- package/components/ProgressBar/index.js +1 -0
- package/components/ProgressSteps/ProgressSteps.js +121 -0
- package/components/ProgressSteps/index.js +1 -0
- package/components/Rating/Rating.js +264 -0
- package/components/Rating/index.js +1 -0
- package/components/SecondaryLink/DarkSecondaryLink.js +97 -0
- package/components/SecondaryLink/LightSecondaryLink.js +93 -0
- package/components/SecondaryLink/index.js +3 -0
- package/components/Sidebar/Navbar.js +328 -0
- package/components/Sidebar/Sidebar.js +180 -0
- package/components/Sidebar/index.js +3 -0
- package/components/StatusChip/PrimaryStatusChip.js +78 -0
- package/components/StatusChip/SecondaryStatusChip.js +78 -0
- package/components/StatusChip/SlimPrimaryStatusChip.js +92 -0
- package/components/StatusChip/SlimSecondaryStatusChip.js +93 -0
- package/components/StatusChip/index.js +6 -0
- package/components/StatusCircle/StatusCircle.js +64 -0
- package/components/StatusCircle/index.js +1 -0
- package/components/Tables/Table.js +156 -0
- package/components/Tables/index.js +1 -0
- package/components/Tooltip/Tooltip.js +479 -0
- package/components/Tooltip/index.js +1 -0
- package/components/Typography/Typography.js +78 -0
- package/components/Typography/index.js +2 -0
- package/components/constants/colors.js +33 -0
- package/components/constants/defaultStyle.js +781 -0
- package/components/constants/defaultThemeColor.js +15 -0
- package/components/constants/index.js +7 -0
- package/components/constants/utils.js +31 -0
- package/components/global/FontStyle.js +131 -0
- package/components/global/index.js +1 -0
- package/dist/index.es.js +2302 -0
- package/dist/index.js +2302 -0
- package/index.js +40 -0
- package/package.json +67 -0
- package/rollup.config.js +53 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
6
|
+
// import 'react-popper-tooltip/dist/styles.css';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Primary UI component for user interaction
|
|
10
|
+
*/
|
|
11
|
+
const OverlayContainer = styled.div`
|
|
12
|
+
${({ theme, type, customStyles }) => {
|
|
13
|
+
if (theme) {
|
|
14
|
+
let tempObj = {};
|
|
15
|
+
if (theme[type]) {
|
|
16
|
+
for (const property in theme['common']) {
|
|
17
|
+
tempObj[property] = theme['common'][property]
|
|
18
|
+
}
|
|
19
|
+
for (const property in theme[type]) {
|
|
20
|
+
tempObj[property] = theme[type][property]
|
|
21
|
+
delete theme.common[property]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return { ...tempObj, ...customStyles };
|
|
25
|
+
}
|
|
26
|
+
}}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export const Overlay = ({
|
|
31
|
+
theme,
|
|
32
|
+
toggleSimple,
|
|
33
|
+
contentTrigger,
|
|
34
|
+
contentOverlay,
|
|
35
|
+
popperOptionsP,
|
|
36
|
+
settingsP,
|
|
37
|
+
customStyles,
|
|
38
|
+
...props
|
|
39
|
+
}) => {
|
|
40
|
+
|
|
41
|
+
let popperOptions = {}
|
|
42
|
+
let settings = {}
|
|
43
|
+
|
|
44
|
+
if (toggleSimple) {
|
|
45
|
+
//Simple tooltip without arrow for text
|
|
46
|
+
popperOptions = {
|
|
47
|
+
...popperOptions,
|
|
48
|
+
modifiers: [
|
|
49
|
+
{
|
|
50
|
+
name: 'offset',
|
|
51
|
+
options: {
|
|
52
|
+
offset: [0, 5],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
strategy: 'absolute'
|
|
57
|
+
}
|
|
58
|
+
settings = { ...settings }
|
|
59
|
+
} else {
|
|
60
|
+
//More styled overlay for other purpose
|
|
61
|
+
popperOptions = {
|
|
62
|
+
...popperOptions,
|
|
63
|
+
modifiers: [
|
|
64
|
+
{
|
|
65
|
+
name: 'offset',
|
|
66
|
+
options: {
|
|
67
|
+
offset: [0, 5],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
strategy: 'absolute'
|
|
72
|
+
}
|
|
73
|
+
settings = {
|
|
74
|
+
...settings,
|
|
75
|
+
trigger: 'click',
|
|
76
|
+
closeOnOutsideClick: true,
|
|
77
|
+
interactive: true,
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
popperOptions = { ...popperOptions, ...popperOptionsP }
|
|
82
|
+
settings = { ...settings, ...settingsP }
|
|
83
|
+
|
|
84
|
+
const {
|
|
85
|
+
getArrowProps,
|
|
86
|
+
getTooltipProps,
|
|
87
|
+
setTooltipRef,
|
|
88
|
+
setTriggerRef,
|
|
89
|
+
visible,
|
|
90
|
+
} = usePopperTooltip({
|
|
91
|
+
...settings
|
|
92
|
+
}, popperOptions);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<>
|
|
96
|
+
<div ref={setTriggerRef}
|
|
97
|
+
style={{ width: 'fit-content', height: 'fit-content' }}
|
|
98
|
+
>
|
|
99
|
+
{contentTrigger}
|
|
100
|
+
</div>
|
|
101
|
+
{visible && (
|
|
102
|
+
<OverlayContainer
|
|
103
|
+
type={toggleSimple ? 'simple-overlay' : 'overlay'}
|
|
104
|
+
theme={theme}
|
|
105
|
+
ref={setTooltipRef}
|
|
106
|
+
{...getTooltipProps({ className: 'tooltip-container' })}
|
|
107
|
+
customStyles={customStyles}
|
|
108
|
+
>
|
|
109
|
+
{contentOverlay}
|
|
110
|
+
</OverlayContainer>
|
|
111
|
+
)}
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
Overlay.propTypes = {
|
|
117
|
+
/**
|
|
118
|
+
* Theme object
|
|
119
|
+
*/
|
|
120
|
+
theme: PropTypes.object,
|
|
121
|
+
/**
|
|
122
|
+
* The element where to attach the tooltip
|
|
123
|
+
*/
|
|
124
|
+
contentTrigger: PropTypes.any,
|
|
125
|
+
/**
|
|
126
|
+
* The element to put inside the overlay
|
|
127
|
+
*/
|
|
128
|
+
contentOverlay: PropTypes.any,
|
|
129
|
+
/**
|
|
130
|
+
* Object to customize the behaviour of the tooltip
|
|
131
|
+
* For more reference see:
|
|
132
|
+
* https://github.com/mohsinulhaq/react-popper-tooltip#readme
|
|
133
|
+
* https://popper.js.org/docs/v2/tutorial/
|
|
134
|
+
*/
|
|
135
|
+
popperOptionsP: PropTypes.object,
|
|
136
|
+
/**
|
|
137
|
+
* Object to customize the settings of the tooltip
|
|
138
|
+
* For more reference see:
|
|
139
|
+
* https://github.com/mohsinulhaq/react-popper-tooltip#readme
|
|
140
|
+
* https://popper.js.org/docs/v2/tutorial/
|
|
141
|
+
*/
|
|
142
|
+
settingsP: PropTypes.object,
|
|
143
|
+
/**
|
|
144
|
+
* Object to pass custom style to the Overlay container
|
|
145
|
+
*/
|
|
146
|
+
customStyles: PropTypes.object,
|
|
147
|
+
/**
|
|
148
|
+
* If true display a simple tooltip without arrow when hover the trigger
|
|
149
|
+
* If false when clicking on the trigger display a more styled overlay
|
|
150
|
+
*/
|
|
151
|
+
toggleSimple: PropTypes.bool,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
Overlay.defaultProps = {
|
|
155
|
+
theme: defaultStyles,
|
|
156
|
+
contentTrigger: <div>Trigger</div>,
|
|
157
|
+
contentOverlay: <div>I am the Overlay</div>,
|
|
158
|
+
};
|
|
159
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Overlay';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
|
|
6
|
+
const StyledPagination = styled.div`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
color: ${({ theme }) => theme.variant['neutral-2']};
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
StyledPagination.defaultProps = {
|
|
13
|
+
theme: defaultThemeColor,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Pagination = ({ ...props }) => {
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<StyledPagination>
|
|
20
|
+
{props.children}
|
|
21
|
+
</ StyledPagination>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
Pagination.propTypes = {
|
|
26
|
+
/**
|
|
27
|
+
* Theme props
|
|
28
|
+
*/
|
|
29
|
+
theme: PropTypes.object,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Pagination.defaultProps = {
|
|
33
|
+
theme: defaultThemeColor,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const Item = styled.div`
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
color: ${({ selected, theme }) => selected ? theme.variant['primary-1'] : null};
|
|
39
|
+
|
|
40
|
+
svg {
|
|
41
|
+
width: 14px;
|
|
42
|
+
height: 14px;
|
|
43
|
+
path {
|
|
44
|
+
fill: ${({ selected, theme }) => selected ? theme.variant['primary-1'] : theme.variant['neutral-2']};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
&:not(:first-child):not(:last-child) {
|
|
50
|
+
margin: 0 22px;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
Item.defaultProps = {
|
|
55
|
+
theme: defaultThemeColor,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
Pagination.PageItem = function PageItem({ selected, ...props }) {
|
|
59
|
+
return (
|
|
60
|
+
<Item selected={selected} {...props}>
|
|
61
|
+
{props.children}
|
|
62
|
+
</Item>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Pagination.PageItem.propTypes = {
|
|
67
|
+
/**
|
|
68
|
+
* Theme props
|
|
69
|
+
*/
|
|
70
|
+
theme: PropTypes.object,
|
|
71
|
+
/**
|
|
72
|
+
* Is Page selected?
|
|
73
|
+
*/
|
|
74
|
+
selected: PropTypes.bool,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
Pagination.PageItem.defaultProps = {
|
|
78
|
+
theme: defaultThemeColor,
|
|
79
|
+
selected: false,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Pagination';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
+
import getDefaultStyles from '../constants/utils';
|
|
7
|
+
import { Label } from '../Label';
|
|
8
|
+
import { hexToRGB } from "../constants/utils";
|
|
9
|
+
|
|
10
|
+
const WrapperDiv = styled.div`
|
|
11
|
+
//Set the styles from the default styles object
|
|
12
|
+
${ ({ theme, type }) => {
|
|
13
|
+
return getDefaultStyles(theme, type);
|
|
14
|
+
}}
|
|
15
|
+
background-color: ${({ color }) => color?
|
|
16
|
+
hexToRGB(color, 0.5) :
|
|
17
|
+
defaultThemeColor.primary['primary-1']};
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const Container = styled.div`
|
|
21
|
+
//Set the styles from the default styles object
|
|
22
|
+
${ ({ theme, type }) => {
|
|
23
|
+
return getDefaultStyles(theme, type);
|
|
24
|
+
}}
|
|
25
|
+
|
|
26
|
+
// custom styles
|
|
27
|
+
${({ progressBarStyle }) => progressBarStyle}
|
|
28
|
+
width: ${({now }) => now+'%'};
|
|
29
|
+
background-color: ${({ color }) => color ?color :defaultThemeColor.primary['primary-1']};
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
export const ProgressBar = ({ labelStyle,progressBarStyle,label,now,color,...props}) => {
|
|
33
|
+
return (
|
|
34
|
+
<div>
|
|
35
|
+
<Label
|
|
36
|
+
theme={defaultStyles}
|
|
37
|
+
customStyles={labelStyle}
|
|
38
|
+
type={'progressbarLabel'}
|
|
39
|
+
text={label}
|
|
40
|
+
{...props} />
|
|
41
|
+
<WrapperDiv progressBarStyle={progressBarStyle} theme={defaultStyles}
|
|
42
|
+
type={'progressWrapper'} color={color} {...props}>
|
|
43
|
+
<Container progressBarStyle={progressBarStyle} now={now} theme={defaultStyles}
|
|
44
|
+
type={'containerWrapper'} color={color} {...props}/>
|
|
45
|
+
</WrapperDiv>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
ProgressBar.propTypes = {
|
|
51
|
+
/**
|
|
52
|
+
* Custom style of the lable of the progressbar
|
|
53
|
+
*/
|
|
54
|
+
labelStyle: PropTypes.object,
|
|
55
|
+
/**
|
|
56
|
+
* Custom style of the progressbar
|
|
57
|
+
*/
|
|
58
|
+
progressBarStyle: PropTypes.object,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Custom color(HEX format) of the progressbar
|
|
62
|
+
*/
|
|
63
|
+
color: PropTypes.string,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* label props
|
|
67
|
+
*/
|
|
68
|
+
label: PropTypes.string,
|
|
69
|
+
/**
|
|
70
|
+
* Progress number
|
|
71
|
+
*/
|
|
72
|
+
now: PropTypes.number,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
ProgressBar.defaultProps = {
|
|
76
|
+
labelStyle:{},
|
|
77
|
+
progressBarStyle: {},
|
|
78
|
+
label:'',
|
|
79
|
+
now:0,
|
|
80
|
+
color: "#2E56F4"
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProgressBar';
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Primary UI component for user interaction
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const StyledContainer = styled.div`
|
|
11
|
+
background: transparent;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
width: ${({ block }) => block ? '100%' : 'fit-content'};
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const StyledText = styled.div`
|
|
18
|
+
margin: 0;
|
|
19
|
+
color: ${({ theme, variantOff }) => theme.variant[variantOff]};
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
|
|
24
|
+
&>div{
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
min-width: 13px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
margin-left: 3px;
|
|
29
|
+
margin-right: 3px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&>div:first-of-type{
|
|
33
|
+
color: ${({ theme, variantOn }) => theme.variant[variantOn]};
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
const StyledSteps = styled.div`
|
|
38
|
+
display: flex;
|
|
39
|
+
margin-left: 20px;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const StyledStep = styled.div`
|
|
43
|
+
height: 6px;
|
|
44
|
+
width: ${({ widthStep }) => widthStep}px;
|
|
45
|
+
margin: 0 3px;
|
|
46
|
+
background-color: ${({ theme, isActive, variantOn, variantOff }) => isActive ? theme.variant[variantOn] : theme.variant[variantOff]};
|
|
47
|
+
border-radius: 19px;
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
export const ProgressSteps = ({ block, variantOn, variantOff, currentStep, totalSteps, widthStep, style, ...props }) => {
|
|
51
|
+
const theme = useTheme() || defaultThemeColor;
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<StyledContainer block={block} {...props} style={style}>
|
|
55
|
+
<StyledText {...props} variantOn={variantOn} variantOff={variantOff}>Page <div>{currentStep}</div> of <div>{totalSteps}</div></StyledText>
|
|
56
|
+
<StyledSteps {...props} >
|
|
57
|
+
{Array.from(Array(totalSteps).keys()).map((index => {
|
|
58
|
+
return <StyledStep key={'formSteps'.concat(index)} isActive={currentStep === index + 1} variantOn={variantOn} variantOff={variantOff} widthStep={widthStep} />
|
|
59
|
+
}))}
|
|
60
|
+
</StyledSteps>
|
|
61
|
+
</StyledContainer>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
ProgressSteps.propTypes = {
|
|
66
|
+
/**
|
|
67
|
+
* Background color of the step and text active base on variant. primary-1, 2, error, etc.
|
|
68
|
+
*/
|
|
69
|
+
variantOn: PropTypes.string,
|
|
70
|
+
/**
|
|
71
|
+
* Background color of the step and text not active base on variant. primary-1, 2, error, etc.
|
|
72
|
+
*/
|
|
73
|
+
variantOff: PropTypes.string,
|
|
74
|
+
/**
|
|
75
|
+
* Optional Block width
|
|
76
|
+
*/
|
|
77
|
+
block: PropTypes.bool,
|
|
78
|
+
/**
|
|
79
|
+
* Theme object
|
|
80
|
+
*/
|
|
81
|
+
theme: PropTypes.object,
|
|
82
|
+
/**
|
|
83
|
+
* Optional value of the current step
|
|
84
|
+
*/
|
|
85
|
+
currentStep: PropTypes.number,
|
|
86
|
+
/**
|
|
87
|
+
* Optional value of the total steps
|
|
88
|
+
*/
|
|
89
|
+
totalSteps: PropTypes.number,
|
|
90
|
+
/**
|
|
91
|
+
* Optional value of width of each step in px
|
|
92
|
+
*/
|
|
93
|
+
widthStep: PropTypes.number,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
StyledContainer.defaultProps = {
|
|
97
|
+
theme: defaultThemeColor,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
StyledText.defaultProps = {
|
|
101
|
+
theme: defaultThemeColor,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
StyledSteps.defaultProps = {
|
|
105
|
+
theme: defaultThemeColor,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
StyledStep.defaultProps = {
|
|
109
|
+
theme: defaultThemeColor,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
ProgressSteps.defaultProps = {
|
|
113
|
+
theme: defaultThemeColor,
|
|
114
|
+
variantOn: 'primary-1',
|
|
115
|
+
variantOff: 'neutral-2',
|
|
116
|
+
block: false,
|
|
117
|
+
currentStep: 1,
|
|
118
|
+
totalSteps: 4,
|
|
119
|
+
widthStep: 43,
|
|
120
|
+
};
|
|
121
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProgressSteps';
|