groundfloor-react-ui 1.2.9 → 1.2.10
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/dist/index.es.js +432 -422
- package/dist/index.js +444 -434
- package/package.json +15 -43
- package/rollup.config.js +6 -6
- 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 +0 -3
- package/assets/icons/arrow-down.svg +0 -3
- package/assets/icons/arrow-rotate.svg +0 -1
- package/assets/icons/arrow-up.svg +0 -3
- package/assets/icons/bell.svg +0 -3
- package/assets/icons/check.svg +0 -3
- package/assets/icons/checkmark.svg +0 -3
- package/assets/icons/chevron-down.svg +0 -3
- package/assets/icons/chevron-left.svg +0 -3
- package/assets/icons/chevron-right.svg +0 -3
- package/assets/icons/cloud-icon.svg +0 -3
- package/assets/icons/connection.svg +0 -3
- package/assets/icons/cross-icon.svg +0 -3
- package/assets/icons/default.svg +0 -1
- package/assets/icons/door-internal-active.svg +0 -1
- package/assets/icons/edit-icon.svg +0 -3
- package/assets/icons/ellipses-horizontal.svg +0 -3
- package/assets/icons/ellipses.svg +0 -3
- package/assets/icons/email.svg +0 -3
- package/assets/icons/eye-hide-view.svg +0 -1
- package/assets/icons/eye-hide.svg +0 -1
- package/assets/icons/file-attach-white.svg +0 -3
- package/assets/icons/file-attach.svg +0 -3
- package/assets/icons/file-icon.svg +0 -1
- package/assets/icons/file-upload.svg +0 -3
- package/assets/icons/functional-equation-regular.svg +0 -147
- package/assets/icons/hamburger-menu.svg +0 -3
- package/assets/icons/heart.svg +0 -18
- package/assets/icons/image.svg +0 -3
- package/assets/icons/info.svg +0 -3
- package/assets/icons/jpg-icon.svg +0 -3
- package/assets/icons/magnifier.svg +0 -3
- package/assets/icons/menu-ellipse-two.svg +0 -1
- package/assets/icons/menu-ellipse.svg +0 -53
- package/assets/icons/pause-all.svg +0 -1
- package/assets/icons/pdf-icon.svg +0 -3
- package/assets/icons/pen-icon.svg +0 -3
- package/assets/icons/plus-outlined.svg +0 -3
- package/assets/icons/resume.svg +0 -1
- package/assets/icons/sign-icon.svg +0 -3
- package/assets/icons/star.svg +0 -3
- package/assets/icons/trash-icon.svg +0 -59
- package/assets/icons/triangle-down.svg +0 -3
- package/assets/icons/users.svg +0 -11
- package/assets/icons/view.svg +0 -3
- package/assets/icons/watcher.svg +0 -3
- package/assets/icons/zoom-in-white.svg +0 -1
- package/assets/styles/global.css +0 -0
- package/assets/styles/global.scss +0 -0
- package/components/Accordion/Accordion.js +0 -167
- package/components/Accordion/AccordionSB.js +0 -170
- package/components/Accordion/AccordionSBfooter.js +0 -171
- package/components/Accordion/index.js +0 -4
- package/components/ArrowBar/ArrowBar.js +0 -276
- package/components/ArrowBar/index.js +0 -2
- package/components/Avatar/Avatar.js +0 -171
- package/components/Avatar/AvatarSB.js +0 -255
- package/components/Avatar/AvatarSBfooter.js +0 -279
- package/components/Avatar/index.js +0 -4
- package/components/Banner/Banner.js +0 -70
- package/components/Banner/index.js +0 -2
- package/components/Breadcrumb/Breadcrumb.js +0 -225
- package/components/Breadcrumb/index.js +0 -2
- package/components/Button/PrimaryButton.js +0 -167
- package/components/Button/SecondaryButton.js +0 -156
- package/components/Button/TinyButton.js +0 -101
- package/components/Button/index.js +0 -6
- package/components/Cards/Card.js +0 -43
- package/components/Cards/CardRef.js +0 -71
- package/components/Cards/DocumentCard.js +0 -215
- package/components/Cards/index.js +0 -5
- package/components/Content/Content.js +0 -50
- package/components/Content/index.js +0 -1
- package/components/DesignComponent/StyledComponent/StyledComponent.js +0 -326
- package/components/DesignComponent/StyledComponent/index.js +0 -1
- package/components/DesignComponent/index.js +0 -1
- package/components/Divider/Divider.js +0 -56
- package/components/Divider/index.js +0 -2
- package/components/Drawer/Drawer.js +0 -84
- package/components/Drawer/index.js +0 -2
- package/components/ErrorBoundary/ErrorBoundary.js +0 -44
- package/components/ErrorBoundary/index.js +0 -1
- package/components/FilterChip/FilterChip.js +0 -70
- package/components/FilterChip/index.js +0 -1
- package/components/Footer/Footer.js +0 -57
- package/components/Footer/FooterContent.js +0 -98
- package/components/Footer/index.js +0 -3
- package/components/Form/FormComponent.js +0 -244
- package/components/Form/HeaderComponent.js +0 -64
- package/components/Form/SubmitComponent.js +0 -63
- package/components/Form/index.js +0 -5
- package/components/GroupAvatars/GroupAvatars.js +0 -139
- package/components/GroupAvatars/index.js +0 -1
- package/components/GroupButtons/ButtonPopup.js +0 -191
- package/components/GroupButtons/GroupButtons.js +0 -150
- package/components/GroupButtons/GroupButtonsPopup.js +0 -163
- package/components/GroupButtons/index.js +0 -3
- package/components/GroupStatusCircle/GroupStatusCircle.js +0 -135
- package/components/GroupStatusCircle/index.js +0 -1
- package/components/Header/Header.js +0 -58
- package/components/Header/index.js +0 -1
- package/components/HyperLink/HyperLink.js +0 -114
- package/components/HyperLink/index.js +0 -1
- package/components/Icon/Icon.js +0 -176
- package/components/Icon/index.js +0 -1
- package/components/Images/Image.js +0 -107
- package/components/Images/index.js +0 -2
- package/components/Inputs/CheckBoxInput.js +0 -341
- package/components/Inputs/ColorInput.js +0 -145
- package/components/Inputs/DateSelect.js +0 -461
- package/components/Inputs/DropdownSelect.js +0 -689
- package/components/Inputs/DropzoneInput.js +0 -450
- package/components/Inputs/NumericInput.js +0 -177
- package/components/Inputs/PasswordInput.js +0 -267
- package/components/Inputs/RadioInput.js +0 -292
- package/components/Inputs/SearchInput.js +0 -19
- package/components/Inputs/Signature.js +0 -369
- package/components/Inputs/TextArea.js +0 -214
- package/components/Inputs/TextInput.js +0 -251
- package/components/Inputs/TimeInput.js +0 -186
- package/components/Inputs/ToggleSwitch.js +0 -189
- package/components/Inputs/index.js +0 -15
- package/components/Label/Label.js +0 -48
- package/components/Label/index.js +0 -1
- package/components/Loaders/Loader.js +0 -179
- package/components/Loaders/index.js +0 -2
- package/components/Modal/ModalComp.js +0 -216
- package/components/Modal/index.js +0 -1
- package/components/Overlay/Overlay.js +0 -158
- package/components/Overlay/index.js +0 -1
- package/components/Pagination/Pagination.js +0 -59
- package/components/Pagination/index.js +0 -1
- package/components/ProgressBar/ProgressBar.js +0 -101
- package/components/ProgressBar/index.js +0 -1
- package/components/ProgressSteps/ProgressSteps.js +0 -121
- package/components/ProgressSteps/index.js +0 -1
- package/components/Rating/Rating.js +0 -258
- package/components/Rating/index.js +0 -1
- package/components/SecondaryLink/DarkSecondaryLink.js +0 -97
- package/components/SecondaryLink/LightSecondaryLink.js +0 -93
- package/components/SecondaryLink/index.js +0 -3
- package/components/Sidebar/Navbar.js +0 -306
- package/components/Sidebar/Sidebar.js +0 -207
- package/components/Sidebar/index.js +0 -3
- package/components/StatusChip/PrimaryStatusChip.js +0 -78
- package/components/StatusChip/SecondaryStatusChip.js +0 -78
- package/components/StatusChip/SlimPrimaryStatusChip.js +0 -92
- package/components/StatusChip/SlimSecondaryStatusChip.js +0 -93
- package/components/StatusChip/index.js +0 -6
- package/components/StatusCircle/StatusCircle.js +0 -64
- package/components/StatusCircle/index.js +0 -1
- package/components/Tables/Table.js +0 -178
- package/components/Tables/index.js +0 -1
- package/components/Tooltip/Tooltip.js +0 -581
- package/components/Tooltip/index.js +0 -1
- package/components/Typography/Typography.js +0 -77
- package/components/Typography/index.js +0 -2
- package/components/constants/colors.js +0 -33
- package/components/constants/defaultStyle.js +0 -804
- package/components/constants/defaultThemeColor.js +0 -16
- package/components/constants/index.js +0 -7
- package/components/constants/utils.js +0 -31
- package/components/global/FontStyle.js +0 -131
- package/components/global/index.js +0 -1
- package/index.js +0 -41
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
-
|
|
6
|
-
const ImageLayout = styled.img`
|
|
7
|
-
//Set the styles from the default styles object
|
|
8
|
-
${({ inBuiltCss, type, size, customStyles }) => {
|
|
9
|
-
if (inBuiltCss) {
|
|
10
|
-
let tempObj = {};
|
|
11
|
-
if (inBuiltCss[type]) {
|
|
12
|
-
for (const property in inBuiltCss['common']) {
|
|
13
|
-
tempObj[property] = inBuiltCss['common'][property]
|
|
14
|
-
}
|
|
15
|
-
for (const property in inBuiltCss[type]) {
|
|
16
|
-
tempObj[property] = inBuiltCss[type][property]
|
|
17
|
-
delete inBuiltCss.common[property]
|
|
18
|
-
}
|
|
19
|
-
for (const property in inBuiltCss[`${type}${size}`]) {
|
|
20
|
-
tempObj[property] = inBuiltCss[`${type}${size}`][property]
|
|
21
|
-
delete inBuiltCss.common[property]
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return { ...tempObj, ...customStyles };
|
|
25
|
-
}
|
|
26
|
-
}}
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export const Image = ({ customStyles, type, size, alt, src, handleImageStatus, ...props }) => {
|
|
30
|
-
|
|
31
|
-
const [imageStatus, setImageStatus] = useState("loading");
|
|
32
|
-
|
|
33
|
-
const imgEl = useRef(null);
|
|
34
|
-
|
|
35
|
-
const onImageLoaded = () => {
|
|
36
|
-
setImageStatus("loaded")
|
|
37
|
-
handleImageStatus && handleImageStatus("loaded")
|
|
38
|
-
};
|
|
39
|
-
const onImageError = () => {
|
|
40
|
-
setImageStatus("failed")
|
|
41
|
-
handleImageStatus && handleImageStatus("failed")
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
const imgElCurrent = imgEl.current;
|
|
46
|
-
|
|
47
|
-
if (imgElCurrent) {
|
|
48
|
-
imgElCurrent.addEventListener("load", onImageLoaded);
|
|
49
|
-
imgElCurrent.addEventListener("error", onImageError);
|
|
50
|
-
|
|
51
|
-
return () => {
|
|
52
|
-
imgElCurrent.removeEventListener("load", onImageLoaded);
|
|
53
|
-
imgElCurrent.removeEventListener("error", onImageError);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}, [imageStatus]);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<ImageLayout
|
|
60
|
-
{...props}
|
|
61
|
-
inBuiltCss={defaultStyles}
|
|
62
|
-
customStyles={customStyles}
|
|
63
|
-
type={type}
|
|
64
|
-
alt={alt}
|
|
65
|
-
src={src}
|
|
66
|
-
ref={imgEl}
|
|
67
|
-
size={size}
|
|
68
|
-
/>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
Image.propTypes = {
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Custom style object
|
|
76
|
-
*/
|
|
77
|
-
customStyles: PropTypes.object,
|
|
78
|
-
/**
|
|
79
|
-
* Type of the component which define the default style
|
|
80
|
-
*/
|
|
81
|
-
type: PropTypes.string,
|
|
82
|
-
/**
|
|
83
|
-
* How large should the Avatar be?
|
|
84
|
-
* Only apply if type='imageAvatar'
|
|
85
|
-
*/
|
|
86
|
-
size: PropTypes.oneOf(['SM', 'MD', 'LG']),
|
|
87
|
-
/**
|
|
88
|
-
* Alternative text for the image
|
|
89
|
-
*/
|
|
90
|
-
alt: PropTypes.string,
|
|
91
|
-
/**
|
|
92
|
-
* URL for the image
|
|
93
|
-
*/
|
|
94
|
-
src: PropTypes.string,
|
|
95
|
-
/**
|
|
96
|
-
* Function that is triggered when the status of the image changes and pass as a parameter the image status itself
|
|
97
|
-
*/
|
|
98
|
-
handleImageStatus: PropTypes.func
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
Image.defaultProps = {
|
|
102
|
-
customStyles: null,
|
|
103
|
-
type: 'image',
|
|
104
|
-
alt: 'image alternative',
|
|
105
|
-
src: null,
|
|
106
|
-
handleImageStatus: null
|
|
107
|
-
}
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { useEffect } from 'react';
|
|
3
|
-
import styled, { useTheme } from 'styled-components';
|
|
4
|
-
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
-
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
|
-
import getDefaultStyles from '../constants/utils';
|
|
7
|
-
import { Icon } from '../Icon';
|
|
8
|
-
import { Label } from '../Label';
|
|
9
|
-
|
|
10
|
-
const CheckBoxOuter = styled.div`
|
|
11
|
-
box-sizing: initial;
|
|
12
|
-
|
|
13
|
-
//Set the styles from the default styles object
|
|
14
|
-
${({ inBuiltCss, defaultCheckBoxOuterStyle }) => {
|
|
15
|
-
return getDefaultStyles(inBuiltCss, defaultCheckBoxOuterStyle);
|
|
16
|
-
}}
|
|
17
|
-
|
|
18
|
-
border: 2px solid ${({
|
|
19
|
-
checkedCheckBoxColor,
|
|
20
|
-
defaultBorderColor,
|
|
21
|
-
checked,
|
|
22
|
-
theme,
|
|
23
|
-
}) => {
|
|
24
|
-
if (checked && checkedCheckBoxColor) return checkedCheckBoxColor;
|
|
25
|
-
else if (checked && !checkedCheckBoxColor)
|
|
26
|
-
return theme.primary['primary-1'];
|
|
27
|
-
else if (!checked && defaultBorderColor) return defaultBorderColor;
|
|
28
|
-
else if (!checked && !defaultBorderColor) return theme.border;
|
|
29
|
-
}}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// custom styles
|
|
33
|
-
${({ checkBoxOuterStyle }) => checkBoxOuterStyle}
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
CheckBoxOuter.defaultProps = {
|
|
37
|
-
theme: defaultThemeColor,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const CheckBoxInner = styled.div`
|
|
41
|
-
box-sizing: initial;
|
|
42
|
-
|
|
43
|
-
//Set the styles from the default styles object
|
|
44
|
-
${({ inBuiltCss, defaultCheckBoxInnerStyle }) => {
|
|
45
|
-
return getDefaultStyles(inBuiltCss, defaultCheckBoxInnerStyle);
|
|
46
|
-
}}
|
|
47
|
-
|
|
48
|
-
// background-image: url(${({ signCheck }) => signCheck});
|
|
49
|
-
background-color: ${({ checked, checkedCheckBoxColor, theme }) => {
|
|
50
|
-
if (checked && checkedCheckBoxColor) return checkedCheckBoxColor;
|
|
51
|
-
else if (checked && !checkedCheckBoxColor)
|
|
52
|
-
return theme.primary['primary-1'];
|
|
53
|
-
else if (!checked) return theme.bgColor;
|
|
54
|
-
}};
|
|
55
|
-
border: 2px solid
|
|
56
|
-
${({ checkedCheckBoxColor, defaultBorderColor, checked, theme }) => {
|
|
57
|
-
if (checked && checkedCheckBoxColor) return checkedCheckBoxColor;
|
|
58
|
-
else if (checked && !checkedCheckBoxColor)
|
|
59
|
-
return theme.primary['primary-1'];
|
|
60
|
-
else if (!checked && defaultBorderColor) return defaultBorderColor;
|
|
61
|
-
else if (!checked && !defaultBorderColor) return theme.border;
|
|
62
|
-
}};
|
|
63
|
-
display: flex;
|
|
64
|
-
justify-content: center;
|
|
65
|
-
align-items: center;
|
|
66
|
-
// custom styles
|
|
67
|
-
${({ checkBoxInnerStyle }) => checkBoxInnerStyle}
|
|
68
|
-
`;
|
|
69
|
-
CheckBoxInner.defaultProps = {
|
|
70
|
-
theme: defaultThemeColor,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const OptionText = styled.span`
|
|
74
|
-
word-break: break-all;
|
|
75
|
-
|
|
76
|
-
//Set the styles from the default styles object
|
|
77
|
-
${({ inBuiltCss, type }) => {
|
|
78
|
-
return getDefaultStyles(inBuiltCss, type);
|
|
79
|
-
}}
|
|
80
|
-
|
|
81
|
-
color: ${({ theme, checked, defaultTextColor, checkedTextColor }) => {
|
|
82
|
-
if (checked && checkedTextColor) return checkedTextColor;
|
|
83
|
-
else if (checked && !checkedTextColor) return theme.neutral['neutral-1'];
|
|
84
|
-
else if (!checked && defaultTextColor) return defaultTextColor;
|
|
85
|
-
else if (!checked && !defaultTextColor) return theme.neutral['neutral-2'];
|
|
86
|
-
}};
|
|
87
|
-
|
|
88
|
-
margin-right: ${({ inline }) => (inline ? '30px' : '10px')};
|
|
89
|
-
|
|
90
|
-
// custom styles
|
|
91
|
-
${({ optionTextStyle }) => optionTextStyle}
|
|
92
|
-
`;
|
|
93
|
-
OptionText.defaultProps = {
|
|
94
|
-
theme: defaultThemeColor,
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const WrapperDiv = styled.label`
|
|
98
|
-
width: fit-content;
|
|
99
|
-
margin-bottom: ${({ inline }) => (!inline ? '18px !important' : '')};
|
|
100
|
-
cursor: pointer;
|
|
101
|
-
display: flex;
|
|
102
|
-
gap: 10px;
|
|
103
|
-
align-items: start;
|
|
104
|
-
|
|
105
|
-
// custom styles
|
|
106
|
-
${({ wrapperStyles }) => wrapperStyles}
|
|
107
|
-
`;
|
|
108
|
-
|
|
109
|
-
const ParentDiv = styled.div`
|
|
110
|
-
flex-direction: ${({ inline }) => (inline ? 'row' : 'column')};
|
|
111
|
-
width: ${({ inline }) => (!inline ? 'auto' : 'initial')};
|
|
112
|
-
`;
|
|
113
|
-
|
|
114
|
-
export const CheckBoxInput = ({
|
|
115
|
-
getCheckedArr,
|
|
116
|
-
checkBoxOuterStyle,
|
|
117
|
-
checkBoxInnerStyle,
|
|
118
|
-
optionTextStyle,
|
|
119
|
-
defaultBorderColor,
|
|
120
|
-
defaultTextColor,
|
|
121
|
-
checkedTextColor,
|
|
122
|
-
checkedCheckBoxColor,
|
|
123
|
-
labelStyle,
|
|
124
|
-
label,
|
|
125
|
-
options,
|
|
126
|
-
setOptions,
|
|
127
|
-
wrapperStyles,
|
|
128
|
-
inline,
|
|
129
|
-
wrapperStyle,
|
|
130
|
-
isRequired,
|
|
131
|
-
...props
|
|
132
|
-
}) => {
|
|
133
|
-
const activeTheme = useTheme() || defaultThemeColor;
|
|
134
|
-
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
filterCheckedOptions(options);
|
|
137
|
-
}, []);
|
|
138
|
-
|
|
139
|
-
const checkBox = (item, i) => {
|
|
140
|
-
let newOptions = [...options];
|
|
141
|
-
newOptions[i].checked = !item.checked;
|
|
142
|
-
setOptions(newOptions);
|
|
143
|
-
filterCheckedOptions(newOptions);
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const filterCheckedOptions = (newOptions) => {
|
|
147
|
-
let filteredOptions = newOptions.filter(
|
|
148
|
-
(option) => option.checked !== false
|
|
149
|
-
);
|
|
150
|
-
getCheckedArr(filteredOptions);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const defaultStyleForWrapper = {
|
|
154
|
-
display: 'flex',
|
|
155
|
-
flexDirection: 'column',
|
|
156
|
-
flexWrap: 'wrap',
|
|
157
|
-
};
|
|
158
|
-
const returnedTarget = Object.assign(defaultStyleForWrapper, wrapperStyle);
|
|
159
|
-
|
|
160
|
-
return (
|
|
161
|
-
<div style={returnedTarget} {...props}>
|
|
162
|
-
<div style={{ display: 'flex' }}>
|
|
163
|
-
<Label
|
|
164
|
-
customStyles={labelStyle}
|
|
165
|
-
type={'check-label'}
|
|
166
|
-
text={label}
|
|
167
|
-
{...props}
|
|
168
|
-
/>
|
|
169
|
-
|
|
170
|
-
{isRequired && (
|
|
171
|
-
<div
|
|
172
|
-
style={{
|
|
173
|
-
marginLeft: '4px',
|
|
174
|
-
color: `${activeTheme.variant['error']}`,
|
|
175
|
-
}}
|
|
176
|
-
>
|
|
177
|
-
*
|
|
178
|
-
</div>
|
|
179
|
-
)}
|
|
180
|
-
</div>
|
|
181
|
-
<ParentDiv
|
|
182
|
-
style={{ display: 'flex', flexWrap: 'wrap' }}
|
|
183
|
-
inline={inline}
|
|
184
|
-
{...props}
|
|
185
|
-
>
|
|
186
|
-
{options?.map((item, i) => {
|
|
187
|
-
return (
|
|
188
|
-
<WrapperDiv
|
|
189
|
-
inline={inline}
|
|
190
|
-
id={item.id}
|
|
191
|
-
key={`${item.name}-${i}`}
|
|
192
|
-
onClick={() => {
|
|
193
|
-
checkBox(item, i);
|
|
194
|
-
}}
|
|
195
|
-
wrapperStyles={wrapperStyles}
|
|
196
|
-
{...props}
|
|
197
|
-
>
|
|
198
|
-
{item.checked ? (
|
|
199
|
-
<CheckBoxInner
|
|
200
|
-
theme={activeTheme}
|
|
201
|
-
inBuiltCss={defaultStyles}
|
|
202
|
-
defaultCheckBoxInnerStyle={'checkBox-inner'}
|
|
203
|
-
checkBoxInnerStyle={{
|
|
204
|
-
...checkBoxInnerStyle,
|
|
205
|
-
cursor: item?.disabled ? 'not-allowed ' : ' pointer',
|
|
206
|
-
borderColor: item?.disabled && item?.disabledColor,
|
|
207
|
-
}}
|
|
208
|
-
defaultBorderColor={defaultBorderColor}
|
|
209
|
-
checkedCheckBoxColor={checkedCheckBoxColor}
|
|
210
|
-
checked={!item?.disabled && item.checked}
|
|
211
|
-
{...props}
|
|
212
|
-
>
|
|
213
|
-
<Icon icon='check-icon' size={18} color='white' />
|
|
214
|
-
</CheckBoxInner>
|
|
215
|
-
) : (
|
|
216
|
-
<CheckBoxOuter
|
|
217
|
-
inBuiltCss={defaultStyles}
|
|
218
|
-
defaultCheckBoxOuterStyle={'checkBox-outer'}
|
|
219
|
-
checkBoxOuterStyle={{
|
|
220
|
-
...checkBoxOuterStyle,
|
|
221
|
-
cursor: item?.disabled ? 'not-allowed ' : ' pointer',
|
|
222
|
-
borderColor: item?.disabledColor,
|
|
223
|
-
}}
|
|
224
|
-
defaultBorderColor={defaultBorderColor}
|
|
225
|
-
theme={activeTheme}
|
|
226
|
-
{...props}
|
|
227
|
-
/>
|
|
228
|
-
)}
|
|
229
|
-
<OptionText
|
|
230
|
-
theme={activeTheme}
|
|
231
|
-
inline={inline}
|
|
232
|
-
optionTextStyle={{
|
|
233
|
-
...optionTextStyle,
|
|
234
|
-
cursor: item?.disabled ? 'not-allowed ' : ' pointer',
|
|
235
|
-
color: item?.disabledColor,
|
|
236
|
-
}}
|
|
237
|
-
checked={item.checked}
|
|
238
|
-
defaultTextColor={defaultTextColor}
|
|
239
|
-
checkedTextColor={checkedTextColor}
|
|
240
|
-
>
|
|
241
|
-
{item.label}
|
|
242
|
-
</OptionText>
|
|
243
|
-
</WrapperDiv>
|
|
244
|
-
);
|
|
245
|
-
})}
|
|
246
|
-
</ParentDiv>
|
|
247
|
-
</div>
|
|
248
|
-
);
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
CheckBoxInput.propTypes = {
|
|
252
|
-
/**
|
|
253
|
-
* Style Custom for whole Checkbox Block
|
|
254
|
-
*/
|
|
255
|
-
wrapperStyle: PropTypes.object,
|
|
256
|
-
/**
|
|
257
|
-
* Label of CheckBox
|
|
258
|
-
*/
|
|
259
|
-
label: PropTypes.string,
|
|
260
|
-
/**
|
|
261
|
-
* Label style of CheckBox
|
|
262
|
-
*/
|
|
263
|
-
labelStyle: PropTypes.object,
|
|
264
|
-
/**
|
|
265
|
-
* Outer CheckBox style
|
|
266
|
-
*/
|
|
267
|
-
checkBoxOuterStyle: PropTypes.object,
|
|
268
|
-
/**
|
|
269
|
-
* Checked CheckBox style
|
|
270
|
-
*/
|
|
271
|
-
checkBoxInnerStyle: PropTypes.object,
|
|
272
|
-
/**
|
|
273
|
-
* Text Style
|
|
274
|
-
*/
|
|
275
|
-
optionTextStyle: PropTypes.object,
|
|
276
|
-
/**
|
|
277
|
-
* Default option text color when not selected
|
|
278
|
-
*/
|
|
279
|
-
defaultTextColor: PropTypes.string,
|
|
280
|
-
/**
|
|
281
|
-
* checked option text color when selected
|
|
282
|
-
*/
|
|
283
|
-
checkedTextColor: PropTypes.string,
|
|
284
|
-
/**
|
|
285
|
-
* Default border color of checkboxes when not selected
|
|
286
|
-
*/
|
|
287
|
-
defaultBorderColor: PropTypes.string,
|
|
288
|
-
/**
|
|
289
|
-
* Checked border color of checkboxes when selected
|
|
290
|
-
*/
|
|
291
|
-
checkedCheckBoxColor: PropTypes.string,
|
|
292
|
-
/**
|
|
293
|
-
* Should checkboxes be inline?
|
|
294
|
-
*/
|
|
295
|
-
inline: PropTypes.bool,
|
|
296
|
-
/**
|
|
297
|
-
* Array that will be rendered for checkbox options
|
|
298
|
-
ex: [
|
|
299
|
-
{
|
|
300
|
-
label: 'Lorem ipsum dolor sit amet',
|
|
301
|
-
value: 'Option One',
|
|
302
|
-
disabled: false,
|
|
303
|
-
id: '1'
|
|
304
|
-
// disabledColor: '#B25068',
|
|
305
|
-
},
|
|
306
|
-
{ label: 'Option Two', value: 'Option Two', checked: true, id: '2' },
|
|
307
|
-
]
|
|
308
|
-
*/
|
|
309
|
-
options: PropTypes.array,
|
|
310
|
-
/**
|
|
311
|
-
* CheckBox value changeHandler
|
|
312
|
-
*/
|
|
313
|
-
setOptions: PropTypes.func,
|
|
314
|
-
/**
|
|
315
|
-
* CheckBox checked value changeHandler
|
|
316
|
-
*/
|
|
317
|
-
getCheckedArr: PropTypes.func,
|
|
318
|
-
/**
|
|
319
|
-
* mandatory field or not
|
|
320
|
-
*/
|
|
321
|
-
isRequired: PropTypes.bool,
|
|
322
|
-
/**
|
|
323
|
-
* Wrapper styles
|
|
324
|
-
*/
|
|
325
|
-
wrapperStyles: PropTypes.object,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
CheckBoxInput.defaultProps = {
|
|
331
|
-
label: '',
|
|
332
|
-
inline: false,
|
|
333
|
-
options: [],
|
|
334
|
-
setOptions: () => { },
|
|
335
|
-
getCheckedArr: () => { },
|
|
336
|
-
labelStyle: {},
|
|
337
|
-
checkBoxOuterStyle: {},
|
|
338
|
-
checkBoxInnerStyle: {},
|
|
339
|
-
isRequired: true,
|
|
340
|
-
wrapperStyles: {},
|
|
341
|
-
};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled, { useTheme } 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
|
-
|
|
9
|
-
const ColorWrapper = styled.div`
|
|
10
|
-
border: 1px solid ${({ theme }) => theme.variant['neutral-4']};
|
|
11
|
-
background-color: ${({ theme }) => theme.bgColor};
|
|
12
|
-
|
|
13
|
-
&:focus-within {
|
|
14
|
-
border: 1px solid ${({ theme }) => theme.primary['primary-1']};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
${({ inBuiltCss, defaultColorWrapperStyle }) => {
|
|
18
|
-
return getDefaultStyles(inBuiltCss, defaultColorWrapperStyle);
|
|
19
|
-
}}
|
|
20
|
-
// custom styles
|
|
21
|
-
${({ customColorWrapperStyle }) => customColorWrapperStyle}
|
|
22
|
-
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
const InputColor = styled.input`
|
|
26
|
-
|
|
27
|
-
border: 0.5px solid ${({ theme }) => theme.variant['neutral-4']};
|
|
28
|
-
box-shadow: 0px 5px 37px rgba(56, 66, 100, 0.0880136);
|
|
29
|
-
-webkit-appearance: none;
|
|
30
|
-
padding: 0;
|
|
31
|
-
|
|
32
|
-
&::-webkit-color-swatch-wrapper {
|
|
33
|
-
padding: 0;
|
|
34
|
-
border-radius: 4px;
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
&::-webkit-color-swatch {
|
|
38
|
-
border: none;
|
|
39
|
-
border-radius: 4px;
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
${({ inBuiltCss, defaultInputColorStyle }) => {
|
|
44
|
-
return getDefaultStyles(inBuiltCss, defaultInputColorStyle);
|
|
45
|
-
}}
|
|
46
|
-
// custom styles
|
|
47
|
-
${({ customInputColorStyle }) => customInputColorStyle}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export const ColorInput = ({
|
|
52
|
-
label,
|
|
53
|
-
labelStyle,
|
|
54
|
-
value,
|
|
55
|
-
setValue,
|
|
56
|
-
customInputColorStyle,
|
|
57
|
-
customColorWrapperStyle,
|
|
58
|
-
id,
|
|
59
|
-
...props
|
|
60
|
-
}) => {
|
|
61
|
-
const activeTheme = useTheme() || defaultThemeColor;
|
|
62
|
-
return (
|
|
63
|
-
|
|
64
|
-
<ColorWrapper customColorWrapperStyle={customColorWrapperStyle}
|
|
65
|
-
defaultColorWrapperStyle={'ColorWrapper'}
|
|
66
|
-
theme={activeTheme}
|
|
67
|
-
inBuiltCss={defaultStyles}
|
|
68
|
-
{...props}>
|
|
69
|
-
|
|
70
|
-
<InputColor
|
|
71
|
-
id={id}
|
|
72
|
-
customInputColorStyle={customInputColorStyle}
|
|
73
|
-
defaultInputColorStyle={'input-color'}
|
|
74
|
-
inBuiltCss={defaultStyles}
|
|
75
|
-
theme={activeTheme}
|
|
76
|
-
{...props}
|
|
77
|
-
type="color"
|
|
78
|
-
value={value}
|
|
79
|
-
|
|
80
|
-
onChange={
|
|
81
|
-
(e) => {
|
|
82
|
-
setValue(e.target.value)
|
|
83
|
-
}}
|
|
84
|
-
/>
|
|
85
|
-
<Label
|
|
86
|
-
themeColor={defaultThemeColor}
|
|
87
|
-
customStyles={labelStyle}
|
|
88
|
-
type={'label-text'}
|
|
89
|
-
text={label}
|
|
90
|
-
style={{
|
|
91
|
-
display: 'flex',
|
|
92
|
-
paddingBottom: '0px',
|
|
93
|
-
paddingLeft: '10px'
|
|
94
|
-
}}
|
|
95
|
-
{...props}
|
|
96
|
-
/>
|
|
97
|
-
|
|
98
|
-
</ColorWrapper>
|
|
99
|
-
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
ColorInput.propTypes = {
|
|
104
|
-
/**
|
|
105
|
-
* Label of ColorInput
|
|
106
|
-
*/
|
|
107
|
-
label: PropTypes.string,
|
|
108
|
-
/**
|
|
109
|
-
* Label style of ColorInput
|
|
110
|
-
*/
|
|
111
|
-
labelStyle: PropTypes.object,
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* color value of input
|
|
115
|
-
*/
|
|
116
|
-
value: PropTypes.string,
|
|
117
|
-
/**
|
|
118
|
-
* value setter function
|
|
119
|
-
*/
|
|
120
|
-
setValue: PropTypes.func,
|
|
121
|
-
/**
|
|
122
|
-
* custom style of color-input box
|
|
123
|
-
*/
|
|
124
|
-
customInputColorStyle: PropTypes.object,
|
|
125
|
-
/**
|
|
126
|
-
* custom style of the wrapper around the color-input
|
|
127
|
-
*/
|
|
128
|
-
customColorWrapperStyle: PropTypes.object,
|
|
129
|
-
/**
|
|
130
|
-
* id of the colorInput
|
|
131
|
-
*/
|
|
132
|
-
id: PropTypes.string
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
ColorInput.defaultProps = {
|
|
137
|
-
label: '',
|
|
138
|
-
labelStyle: {},
|
|
139
|
-
customInputColorStyle: {},
|
|
140
|
-
customColorWrapperStyle: {},
|
|
141
|
-
value: '#FFFFFF',
|
|
142
|
-
setValue: () => { },
|
|
143
|
-
id: ''
|
|
144
|
-
};
|
|
145
|
-
|