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,123 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import getDefaultStyles from '../constants/utils';
|
|
6
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
7
|
+
|
|
8
|
+
const CheckBoxWrapper = styled.div`
|
|
9
|
+
${({ theme, defaultCheckBoxWrapperStyle }) => {
|
|
10
|
+
return getDefaultStyles(theme, defaultCheckBoxWrapperStyle);
|
|
11
|
+
}}
|
|
12
|
+
`;
|
|
13
|
+
const CheckBoxLabel = styled.label`
|
|
14
|
+
//Set the styles from the default styles object
|
|
15
|
+
${({ theme, defaultCheckBoxLabelStyle }) => {
|
|
16
|
+
return getDefaultStyles(theme, defaultCheckBoxLabelStyle);
|
|
17
|
+
}}
|
|
18
|
+
background-color: ${({ checked, backgroundColor, disabledColor }) => checked ?
|
|
19
|
+
backgroundColor : disabledColor};
|
|
20
|
+
// custom styles
|
|
21
|
+
${({ customToggleBoxStyle }) => customToggleBoxStyle}
|
|
22
|
+
&:before {
|
|
23
|
+
content: "";
|
|
24
|
+
display: block;
|
|
25
|
+
border-radius: 50%;
|
|
26
|
+
width: 16px;
|
|
27
|
+
height: 16px;
|
|
28
|
+
margin-top: 3px;
|
|
29
|
+
background: ${({ switchColor }) => switchColor};
|
|
30
|
+
transition: 0.2s;
|
|
31
|
+
margin-left: ${({ checked }) => checked ? '4px' : '25px'};
|
|
32
|
+
|
|
33
|
+
// custom styles
|
|
34
|
+
${({ customSwitchStyle }) => customSwitchStyle}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const CheckBox = styled.input.attrs({ type: "checkbox" })`
|
|
41
|
+
opacity: 0;
|
|
42
|
+
z-index: 1;
|
|
43
|
+
border-radius: 31px;
|
|
44
|
+
width: 45px;
|
|
45
|
+
height: 22px;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
const OptionText = styled.span`
|
|
50
|
+
//Set the styles from the default styles object
|
|
51
|
+
${({ theme, defaultOptionTextStyle }) => {
|
|
52
|
+
return getDefaultStyles(theme, defaultOptionTextStyle);
|
|
53
|
+
}}
|
|
54
|
+
|
|
55
|
+
// custom styles
|
|
56
|
+
${({ optionStyle }) => optionStyle}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
export const ToggleSwitch = ({ checked, customSwitchStyle, customToggleBoxStyle, backgroundColor, disabledColor, switchColor, onClick, trueLabel, falseLabel, optionStyle, ...props }) => {
|
|
60
|
+
return (
|
|
61
|
+
<CheckBoxWrapper theme={defaultStyles} defaultCheckBoxWrapperStyle={'toggle-switch-wrapper'} {...props} >
|
|
62
|
+
<CheckBox {...props}
|
|
63
|
+
id="checkbox"
|
|
64
|
+
theme={defaultStyles}
|
|
65
|
+
defaultCheckBoxStyle={'toggle-switch-checkbox'}
|
|
66
|
+
onClick={() => { onClick(!checked) }}
|
|
67
|
+
isChecked={checked}
|
|
68
|
+
/>
|
|
69
|
+
<CheckBoxLabel {...props}
|
|
70
|
+
htmlFor="checkbox"
|
|
71
|
+
customToggleBoxStyle={customToggleBoxStyle}
|
|
72
|
+
customSwitchStyle={customSwitchStyle}
|
|
73
|
+
disabledColor={disabledColor}
|
|
74
|
+
backgroundColor={backgroundColor}
|
|
75
|
+
switchColor={switchColor}
|
|
76
|
+
theme={defaultStyles}
|
|
77
|
+
defaultCheckBoxLabelStyle={'toggle-switch-checkbox-label'}
|
|
78
|
+
checked={checked}
|
|
79
|
+
/>
|
|
80
|
+
<OptionText optionStyle={optionStyle}
|
|
81
|
+
theme={defaultStyles}
|
|
82
|
+
defaultOptionTextStyle={'toggle-switch-option-text'} {...props} >{checked ? trueLabel : falseLabel}</OptionText>
|
|
83
|
+
</CheckBoxWrapper>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
ToggleSwitch.propTypes = {
|
|
88
|
+
/**
|
|
89
|
+
* Custom styles for the toggleBox
|
|
90
|
+
*/
|
|
91
|
+
customToggleBoxStyle: PropTypes.object,
|
|
92
|
+
/**
|
|
93
|
+
* Custom styles for the toggleSwitch
|
|
94
|
+
*/
|
|
95
|
+
customSwitchStyle: PropTypes.object,
|
|
96
|
+
/**
|
|
97
|
+
* Type of color on background of toggleSwitch
|
|
98
|
+
*/
|
|
99
|
+
backgroundColor: PropTypes.string,
|
|
100
|
+
/**
|
|
101
|
+
* default Toggle State
|
|
102
|
+
*/
|
|
103
|
+
checked: PropTypes.bool,
|
|
104
|
+
/**
|
|
105
|
+
* label when toggle state is checked
|
|
106
|
+
* */
|
|
107
|
+
trueLabel: PropTypes.string,
|
|
108
|
+
/**
|
|
109
|
+
* label when toggle state is not checked
|
|
110
|
+
* */
|
|
111
|
+
falseLabel: PropTypes.string,
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
ToggleSwitch.defaultProps = {
|
|
115
|
+
backgroundColor: `${defaultThemeColor.primary['primary-1']}`,
|
|
116
|
+
switchColor: `${defaultThemeColor.bgColor}`,
|
|
117
|
+
disabledColor: `${defaultThemeColor.neutral['neutral-2']}`,
|
|
118
|
+
checked: false,
|
|
119
|
+
trueLabel: 'Yes',
|
|
120
|
+
falseLabel: 'No',
|
|
121
|
+
customSwitchStyle: {},
|
|
122
|
+
customToggleBoxStyle: {}
|
|
123
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './TextInput';
|
|
2
|
+
export * from './CheckBoxInput';
|
|
3
|
+
export * from './TimeInput';
|
|
4
|
+
export * from './ToggleSwitch';
|
|
5
|
+
export * from './RadioInput';
|
|
6
|
+
export * from './DropzoneInput';
|
|
7
|
+
export * from './DateSelect';
|
|
8
|
+
export * from './Signature';
|
|
9
|
+
export * from './TextArea';
|
|
10
|
+
export * from './NumericInput';
|
|
11
|
+
export * from './DropdownSelect';
|
|
12
|
+
export * from './SearchInput';
|
|
13
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
6
|
+
import getDefaultStyles from '../constants/utils';
|
|
7
|
+
|
|
8
|
+
const LabelLayout = styled.label`
|
|
9
|
+
//Set the styles from the default styles object
|
|
10
|
+
${ ({ theme, type }) => {
|
|
11
|
+
return getDefaultStyles(theme, type);
|
|
12
|
+
}}
|
|
13
|
+
|
|
14
|
+
// custom styles
|
|
15
|
+
${({customStyles})=>customStyles}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const Label = ({ customStyles, text, className,required, ...props }) => {
|
|
19
|
+
const theme = defaultStyles;
|
|
20
|
+
return (
|
|
21
|
+
<LabelLayout required={required} theme={theme} customStyles={customStyles} type={'label'} {...props}>
|
|
22
|
+
{text}
|
|
23
|
+
{required && <div style={{
|
|
24
|
+
marginLeft: '4px',
|
|
25
|
+
color: `${defaultThemeColor.variant['error']}`
|
|
26
|
+
}} >*</div>}
|
|
27
|
+
</LabelLayout>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Label.propTypes = {
|
|
34
|
+
/**
|
|
35
|
+
* Custom style object
|
|
36
|
+
*/
|
|
37
|
+
customStyles: PropTypes.object,
|
|
38
|
+
/**
|
|
39
|
+
* Title Content
|
|
40
|
+
*/
|
|
41
|
+
text: PropTypes.string,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Label.defaultProps = {
|
|
45
|
+
text:''
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Label';
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled, { keyframes, css } from "styled-components";
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
|
|
6
|
+
const ldsSpinner = keyframes`
|
|
7
|
+
0% {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
}
|
|
10
|
+
100% {
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const Spinner = styled.div`
|
|
16
|
+
${({ size, thickness, propellerHeight }) => {
|
|
17
|
+
return css`
|
|
18
|
+
display: inline-block;
|
|
19
|
+
position: relative;
|
|
20
|
+
width: ${size}px;
|
|
21
|
+
height: ${size}px;
|
|
22
|
+
|
|
23
|
+
div{
|
|
24
|
+
transform-origin: 0px ${size / 2}px;
|
|
25
|
+
animation: ${ldsSpinner} 1s linear infinite;
|
|
26
|
+
width: fit-content;
|
|
27
|
+
|
|
28
|
+
::after {
|
|
29
|
+
content: "";
|
|
30
|
+
display: block;
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0px;
|
|
33
|
+
left: 0px;
|
|
34
|
+
width: ${thickness}px; //2px;
|
|
35
|
+
height: calc(${size}px*${propellerHeight}/100);
|
|
36
|
+
border-radius: 20%;
|
|
37
|
+
${({ theme, type, customStyles }) => {
|
|
38
|
+
if (theme) {
|
|
39
|
+
let tempArr = [];
|
|
40
|
+
if (theme[type]) {
|
|
41
|
+
for (const property in theme[type]) {
|
|
42
|
+
tempArr.push(`${property}:${theme[type][property]};`)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (customStyles) {
|
|
46
|
+
for (const property in customStyles) {
|
|
47
|
+
tempArr.push(`${property}:${customStyles[property]};`)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return [...tempArr];
|
|
51
|
+
}
|
|
52
|
+
}}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
div:nth-child(1) {
|
|
57
|
+
transform: translate(${size / 2}px, 0px) rotate(0deg);
|
|
58
|
+
animation-delay: -0.875s;
|
|
59
|
+
::after{
|
|
60
|
+
transform: translate(-${thickness / 2}px, 0px) //-1
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
div:nth-child(2) {
|
|
65
|
+
transform: translate(${size / 2}px, 0px) rotate(45deg);
|
|
66
|
+
animation-delay: -0.75s;
|
|
67
|
+
::after{
|
|
68
|
+
transform: translate(-${thickness / 2}px, 0px) //-1
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
div:nth-child(3) {
|
|
73
|
+
transform: translate(${size / 2}px, 0px) rotate(90deg) ;
|
|
74
|
+
animation-delay: -0.625s;
|
|
75
|
+
::after{
|
|
76
|
+
transform: translate(-${thickness / 2}px, 0px) //-1
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
div:nth-child(4) {
|
|
81
|
+
transform: translate(${size / 2}px, 0px) rotate(135deg);
|
|
82
|
+
animation-delay: -0.5s;
|
|
83
|
+
::after{
|
|
84
|
+
transform: translate(-${thickness / 2}px, 0px) //-1
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
div:nth-child(5) {
|
|
89
|
+
transform: translate(${size / 2}px, 0px) rotate(180deg);
|
|
90
|
+
animation-delay: -0.375s;
|
|
91
|
+
::after{
|
|
92
|
+
transform: translate(-${thickness / 2}px, 0px) //-1
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
div:nth-child(6) {
|
|
97
|
+
transform: translate(${size / 2}px, 0px) rotate(225deg);
|
|
98
|
+
animation-delay: -0.25s;
|
|
99
|
+
::after{
|
|
100
|
+
transform: translate(-${thickness / 2}px, 0px) //-1
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
div:nth-child(7) {
|
|
105
|
+
transform: translate(${size / 2}px, 0px) rotate(270deg);
|
|
106
|
+
animation-delay: -0.125s;
|
|
107
|
+
::after{
|
|
108
|
+
transform: translate(-${thickness / 2}px, 0px)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
div:nth-child(8) {
|
|
113
|
+
transform: translate(${size / 2}px, 0px) rotate(315deg);
|
|
114
|
+
animation-delay: 0s;
|
|
115
|
+
::after{
|
|
116
|
+
transform: translate(-${thickness / 2}px, 0px)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
div:nth-child(9) {
|
|
121
|
+
transform: translate(${size / 2}px, 0px) rotate(0deg);
|
|
122
|
+
::after{
|
|
123
|
+
transform: translate(-${thickness / 2}px, 0px)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`
|
|
130
|
+
|
|
131
|
+
export const Loader = ({ size, thickness, propellerHeight, customStyles }) => {
|
|
132
|
+
const theme = defaultStyles;
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<Spinner theme={theme} size={size} thickness={thickness} propellerHeight={propellerHeight} customStyles={customStyles} type='spinner'>
|
|
136
|
+
<div></div>
|
|
137
|
+
<div></div>
|
|
138
|
+
<div></div>
|
|
139
|
+
<div></div>
|
|
140
|
+
<div></div>
|
|
141
|
+
<div></div>
|
|
142
|
+
<div></div>
|
|
143
|
+
<div></div>
|
|
144
|
+
<div></div>
|
|
145
|
+
</Spinner>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
Spinner.defaultProps = {
|
|
150
|
+
theme: defaultStyles,
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
Loader.propTypes = {
|
|
154
|
+
/**
|
|
155
|
+
* Diameter of the spinner in px
|
|
156
|
+
*/
|
|
157
|
+
size: PropTypes.number,
|
|
158
|
+
/**
|
|
159
|
+
* Thickness of the propeller
|
|
160
|
+
*/
|
|
161
|
+
thickness: PropTypes.number,
|
|
162
|
+
/**
|
|
163
|
+
* Heightof the propeller in percentage of the size (eg 100 = size, 50 = size/2).
|
|
164
|
+
*/
|
|
165
|
+
propellerHeight: PropTypes.number,
|
|
166
|
+
/**
|
|
167
|
+
* CustomStyles is an object to apply custom style to the ::after pseudo element.
|
|
168
|
+
* But mainly only used to apply a custom background-color
|
|
169
|
+
*/
|
|
170
|
+
customStyles: PropTypes.object,
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
Loader.defaultProps = {
|
|
174
|
+
size: 20,
|
|
175
|
+
thickness: 2,
|
|
176
|
+
propellerHeight: 25,
|
|
177
|
+
customStyles: null,
|
|
178
|
+
}
|
|
179
|
+
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
4
|
+
import getDefaultStyles from '../constants/utils';
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const Background = styled.div`
|
|
9
|
+
//Set the styles from the default styles object
|
|
10
|
+
${({ theme, type }) => {
|
|
11
|
+
return getDefaultStyles(theme, type);
|
|
12
|
+
}}
|
|
13
|
+
|
|
14
|
+
// custom styles
|
|
15
|
+
${({ customBackgroundStyle }) => customBackgroundStyle}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const ModalWrapper = styled.div`
|
|
19
|
+
|
|
20
|
+
//Set the styles from the default styles object
|
|
21
|
+
${({ theme, type }) => {
|
|
22
|
+
return getDefaultStyles(theme, type);
|
|
23
|
+
}}
|
|
24
|
+
|
|
25
|
+
// custom styles
|
|
26
|
+
${({ customWrapperStyle }) => customWrapperStyle}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const CloseModalButton = styled.div`
|
|
30
|
+
//Set the styles from the default styles object
|
|
31
|
+
${({ theme, type }) => {
|
|
32
|
+
return getDefaultStyles(theme, type);
|
|
33
|
+
}}
|
|
34
|
+
|
|
35
|
+
// custom styles
|
|
36
|
+
${({ closeModalButtonStyle }) => closeModalButtonStyle}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const Modal = ({ showModal, setShowModal, customBackgroundStyle, customWrapperStyle, modalCloseButton, closeModalButtonStyle, children,...props }) => {
|
|
40
|
+
const modalRef = useRef();
|
|
41
|
+
|
|
42
|
+
const closeModal = e => {
|
|
43
|
+
if (modalRef.current === e.target) {
|
|
44
|
+
setShowModal(false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const keyPress = useCallback(
|
|
49
|
+
e => {
|
|
50
|
+
if (e.key === 'Escape' && showModal) {
|
|
51
|
+
setShowModal(false);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
[setShowModal, showModal]
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
useEffect(
|
|
58
|
+
() => {
|
|
59
|
+
document.addEventListener('keydown', keyPress);
|
|
60
|
+
return () => document.removeEventListener('keydown', keyPress);
|
|
61
|
+
},
|
|
62
|
+
[keyPress]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div>
|
|
67
|
+
{showModal ? (
|
|
68
|
+
<Background
|
|
69
|
+
theme={defaultStyles}
|
|
70
|
+
type={'modal-background'}
|
|
71
|
+
onClick={closeModal}
|
|
72
|
+
ref={modalRef}
|
|
73
|
+
customBackgroundStyle={customBackgroundStyle} {...props}>
|
|
74
|
+
<ModalWrapper
|
|
75
|
+
theme={defaultStyles}
|
|
76
|
+
type={'modal-wrapper'}
|
|
77
|
+
showModal={showModal}
|
|
78
|
+
customWrapperStyle={customWrapperStyle} {...props}>
|
|
79
|
+
{modalCloseButton &&
|
|
80
|
+
<CloseModalButton
|
|
81
|
+
onClick={() => setShowModal(prev => !prev)}
|
|
82
|
+
theme={defaultStyles}
|
|
83
|
+
type={'modal-close-button'}
|
|
84
|
+
closeModalButtonStyle={closeModalButtonStyle}>
|
|
85
|
+
X
|
|
86
|
+
</CloseModalButton>}
|
|
87
|
+
|
|
88
|
+
{children}
|
|
89
|
+
</ModalWrapper>
|
|
90
|
+
</Background>
|
|
91
|
+
) : null}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
Modal.propTypes = {
|
|
97
|
+
/**
|
|
98
|
+
* Show modal
|
|
99
|
+
*/
|
|
100
|
+
showModal: PropTypes.bool.isRequired,
|
|
101
|
+
/**
|
|
102
|
+
* Show modal function
|
|
103
|
+
*/
|
|
104
|
+
setShowModal: PropTypes.func.isRequired,
|
|
105
|
+
/**
|
|
106
|
+
* Show modal close button or not
|
|
107
|
+
*/
|
|
108
|
+
modalCloseButton: PropTypes.bool,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
Modal.defaultProps = {
|
|
112
|
+
showModal: false,
|
|
113
|
+
setShowModal: ()=>{},
|
|
114
|
+
modalCloseButton: true,
|
|
115
|
+
}
|
|
116
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import Modal from "react-modal";
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import getDefaultStyles from '../constants/utils';
|
|
6
|
+
import PropTypes from "prop-types";
|
|
7
|
+
import { Icon } from '../Icon';
|
|
8
|
+
|
|
9
|
+
const customStyles = {
|
|
10
|
+
overlay: {
|
|
11
|
+
zIndex: '999'
|
|
12
|
+
},
|
|
13
|
+
content: {
|
|
14
|
+
top: '50%',
|
|
15
|
+
left: '50%',
|
|
16
|
+
right: 'auto',
|
|
17
|
+
bottom: 'auto',
|
|
18
|
+
marginRight: '-50%',
|
|
19
|
+
padding: '3rem 3rem 0.8rem 3rem',
|
|
20
|
+
transform: 'translate(-50%, -50%)',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const ModalClose = styled.button`
|
|
25
|
+
//Set the styles from the default styles object
|
|
26
|
+
${({ theme, type }) => {
|
|
27
|
+
return getDefaultStyles(theme, type);
|
|
28
|
+
}}
|
|
29
|
+
// custom styles
|
|
30
|
+
${({ customModalCloseStyle }) => customModalCloseStyle}
|
|
31
|
+
${'' /* background: transparent; */}
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
const ModalHeader = styled.div`
|
|
35
|
+
.header-title{
|
|
36
|
+
display: flex;
|
|
37
|
+
gap: 10px;
|
|
38
|
+
align-items: center;
|
|
39
|
+
}
|
|
40
|
+
.header-description{
|
|
41
|
+
margin-top: 5px;
|
|
42
|
+
}
|
|
43
|
+
h4 {
|
|
44
|
+
margin-bottom: 0;
|
|
45
|
+
}
|
|
46
|
+
// custom styles
|
|
47
|
+
${({ customModalHeaderStyle }) => customModalHeaderStyle}
|
|
48
|
+
`
|
|
49
|
+
const ModalBody = styled.div`
|
|
50
|
+
//Set the styles from the default styles object
|
|
51
|
+
${({ theme, type }) => {
|
|
52
|
+
return getDefaultStyles(theme, type);
|
|
53
|
+
}}
|
|
54
|
+
// custom styles
|
|
55
|
+
${({ customModalBodyStyle }) => customModalBodyStyle}
|
|
56
|
+
`
|
|
57
|
+
|
|
58
|
+
const ModalFooter = styled.div`
|
|
59
|
+
//Set the styles from the default styles object
|
|
60
|
+
${({ theme, type }) => {
|
|
61
|
+
return getDefaultStyles(theme, type);
|
|
62
|
+
}}
|
|
63
|
+
// custom styles
|
|
64
|
+
${({ customModalFooterStyle }) => customModalFooterStyle}
|
|
65
|
+
`
|
|
66
|
+
|
|
67
|
+
Modal.setAppElement("#root");
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
export const ModalComp = ({ modalIsOpen, toggleModal, closeOnOutsideClick, headerContent, bodyContent, footerContent, customModalCloseStyle, customModalHeaderStyle, customModalBodyStyle, customModalFooterStyle, ...props }) => {
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<Modal
|
|
74
|
+
isOpen={modalIsOpen}
|
|
75
|
+
// onAfterOpen={afterOpenModal}
|
|
76
|
+
onRequestClose={closeOnOutsideClick ? toggleModal : undefined}
|
|
77
|
+
style={customStyles}
|
|
78
|
+
contentLabel="Example Modal"
|
|
79
|
+
{...props}
|
|
80
|
+
>
|
|
81
|
+
<ModalClose theme={defaultStyles}
|
|
82
|
+
type={'modalComp-modal-close'} style={customModalCloseStyle} onClick={toggleModal}>
|
|
83
|
+
<Icon icon='cross-icon' />
|
|
84
|
+
</ModalClose>
|
|
85
|
+
|
|
86
|
+
<ModalHeader style={customModalHeaderStyle}>
|
|
87
|
+
{headerContent}
|
|
88
|
+
</ModalHeader>
|
|
89
|
+
<ModalBody theme={defaultStyles}
|
|
90
|
+
type={'modalComp-modal-body'} style={customModalBodyStyle}>
|
|
91
|
+
{bodyContent}
|
|
92
|
+
</ModalBody>
|
|
93
|
+
|
|
94
|
+
<ModalFooter theme={defaultStyles}
|
|
95
|
+
type={'modalComp-modal-footer'} style={customModalFooterStyle}>
|
|
96
|
+
{/* <hr /> */}
|
|
97
|
+
{footerContent}
|
|
98
|
+
</ModalFooter>
|
|
99
|
+
</Modal>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
ModalComp.propTypes = {
|
|
104
|
+
/**
|
|
105
|
+
* Show modal
|
|
106
|
+
*/
|
|
107
|
+
modalIsOpen: PropTypes.bool,
|
|
108
|
+
/**
|
|
109
|
+
* Show modal function
|
|
110
|
+
*/
|
|
111
|
+
toggleModal: PropTypes.func,
|
|
112
|
+
/**
|
|
113
|
+
* Close modal on clicking outside
|
|
114
|
+
*/
|
|
115
|
+
closeOnOutsideClick: PropTypes.bool,
|
|
116
|
+
/**
|
|
117
|
+
* Modal Header Content
|
|
118
|
+
*/
|
|
119
|
+
headerContent: PropTypes.any,
|
|
120
|
+
/**
|
|
121
|
+
* Modal Body Content
|
|
122
|
+
*/
|
|
123
|
+
bodyContent: PropTypes.any,
|
|
124
|
+
/**
|
|
125
|
+
* Modal Footer Content
|
|
126
|
+
*/
|
|
127
|
+
footerContent: PropTypes.any,
|
|
128
|
+
/**
|
|
129
|
+
* Modal Close icon custom styles
|
|
130
|
+
*/
|
|
131
|
+
customModalCloseStyle: PropTypes.object,
|
|
132
|
+
/**
|
|
133
|
+
* Modal Header custom styles
|
|
134
|
+
*/
|
|
135
|
+
customModalHeaderStyle: PropTypes.object,
|
|
136
|
+
/**
|
|
137
|
+
* Modal Body custom styles
|
|
138
|
+
*/
|
|
139
|
+
customModalBodyStyle: PropTypes.object,
|
|
140
|
+
/**
|
|
141
|
+
* Modal Footer custom styles
|
|
142
|
+
*/
|
|
143
|
+
customModalFooterStyle: PropTypes.object
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
ModalComp.defaultProps = {
|
|
147
|
+
modalIsOpen: false,
|
|
148
|
+
toggleModal: () => { },
|
|
149
|
+
closeOnOutsideClick: false,
|
|
150
|
+
headerContent: '',
|
|
151
|
+
bodyContent: '',
|
|
152
|
+
footerContent: '',
|
|
153
|
+
customModalCloseStyle: {},
|
|
154
|
+
customModalHeaderStyle: {},
|
|
155
|
+
customModalBodyStyle: {},
|
|
156
|
+
customModalFooterStyle: {}
|
|
157
|
+
}
|
|
158
|
+
|