groundfloor-react-ui 1.0.0 → 1.0.3
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 +9 -2
- package/assets/icons/eye-hide.svg +1 -1
- package/assets/icons/file-upload.svg +3 -0
- package/components/Accordion/Accordion.js +2 -2
- package/components/Button/PrimaryButton.js +4 -7
- package/components/Button/SecondaryButton.js +7 -8
- package/components/Footer/{FooterContentLev3.js → FooterContent.js} +6 -2
- package/components/Footer/index.js +1 -1
- package/components/Form/FormComponent.js +5 -2
- package/components/Form/HeaderComponent.js +1 -6
- package/components/Icon/Icon.js +16 -6
- package/components/Inputs/CheckBoxInput.js +1 -1
- package/components/Inputs/DateSelect.js +3 -4
- package/components/Inputs/DropdownSelect.js +292 -289
- package/components/Inputs/DropzoneInput.js +225 -137
- package/components/Inputs/NumericInput.js +6 -11
- package/components/Inputs/PasswordInput.js +192 -0
- package/components/Inputs/Signature.js +142 -109
- package/components/Inputs/TextArea.js +3 -4
- package/components/Inputs/TextInput.js +6 -7
- package/components/Inputs/TimeInput.js +5 -6
- package/components/Inputs/index.js +1 -0
- package/components/Modal/ModalComp.js +80 -46
- package/components/Modal/index.js +0 -1
- package/components/constants/defaultStyle.js +28 -33
- package/components/constants/defaultThemeColor.js +2 -1
- package/dist/index.es.js +538 -493
- package/dist/index.js +388 -343
- package/package.json +1 -1
- package/components/Inputs/CheckBoxEditableInput.js +0 -352
- package/components/Inputs/CheckBoxInputMS.js +0 -160
- package/components/Inputs/TextInputClicable.js +0 -198
- package/components/Inputs/TextInputClicableMS.js +0 -255
- package/components/Modal/Modal.js +0 -116
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
+
import defaultStyles from '../constants/defaultStyle';
|
|
6
|
+
import getDefaultStyles from '../constants/utils';
|
|
7
|
+
import { Label } from '../Label';
|
|
8
|
+
import { Icon } from '../Icon';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { useEffect } from 'react';
|
|
11
|
+
|
|
12
|
+
const TextWrapper = styled.div`
|
|
13
|
+
//Set the styles from the default styles object
|
|
14
|
+
${({ theme, defaultWrapperStyle }) => {
|
|
15
|
+
return getDefaultStyles(theme, defaultWrapperStyle);
|
|
16
|
+
}}
|
|
17
|
+
|
|
18
|
+
border: ${({ isValid, themeColor }) =>
|
|
19
|
+
!isValid
|
|
20
|
+
? '1px solid ' + themeColor.variant['error']
|
|
21
|
+
: '1px solid ' + defaultThemeColor.border};
|
|
22
|
+
|
|
23
|
+
.input-icon svg path {
|
|
24
|
+
fill: ${({ themeColor }) => themeColor.variant['neutral-1']};
|
|
25
|
+
}
|
|
26
|
+
.input-icon {
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:focus-within {
|
|
31
|
+
border: 1px solid ${({ themeColor }) => themeColor.variant['primary-1']};
|
|
32
|
+
outline: none;
|
|
33
|
+
|
|
34
|
+
.input-icon svg path {
|
|
35
|
+
fill: ${({ themeColor }) => themeColor.variant['primary-1']};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// custom styles
|
|
40
|
+
${({ textBoxStyle }) => textBoxStyle}
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const Input = styled.input`
|
|
44
|
+
width: inherit;
|
|
45
|
+
//Set the styles from the default styles object
|
|
46
|
+
${({ theme, defaultInputStyle }) => {
|
|
47
|
+
return getDefaultStyles(theme, defaultInputStyle);
|
|
48
|
+
}}
|
|
49
|
+
|
|
50
|
+
// custom styles
|
|
51
|
+
${({ inputStyle }) => inputStyle}
|
|
52
|
+
|
|
53
|
+
.sc-furwcr bxRAoq {
|
|
54
|
+
color: ${defaultThemeColor.variant['neutral-3']};
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const inline = css`
|
|
59
|
+
display: flex;
|
|
60
|
+
gap: 7px;
|
|
61
|
+
align-items: center;
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
const Form = styled.div`
|
|
65
|
+
${({ labelInline }) => (labelInline ? inline : null)}
|
|
66
|
+
.err-text {
|
|
67
|
+
color: ${({ themeColor }) => themeColor.variant['error']};
|
|
68
|
+
margin-top: 5px;
|
|
69
|
+
font-size: 10px;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
Form.defaultProps = {
|
|
74
|
+
themeColor: defaultThemeColor,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const PasswordInput = ({
|
|
78
|
+
themeColor,
|
|
79
|
+
textBoxStyle,
|
|
80
|
+
labelStyle,
|
|
81
|
+
inputStyle,
|
|
82
|
+
errMsg,
|
|
83
|
+
required,
|
|
84
|
+
label,
|
|
85
|
+
labelInline,
|
|
86
|
+
isValid,
|
|
87
|
+
...props
|
|
88
|
+
}) => {
|
|
89
|
+
const [showEye, setShowEye] = useState(false);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Form labelInline={labelInline} {...props}>
|
|
93
|
+
<div style={{ display: 'flex' }}>
|
|
94
|
+
<Label
|
|
95
|
+
customStyles={labelStyle}
|
|
96
|
+
type={'label-text'}
|
|
97
|
+
labelInline={labelInline}
|
|
98
|
+
text={label}
|
|
99
|
+
errMsg={errMsg}
|
|
100
|
+
style={{
|
|
101
|
+
display: 'flex',
|
|
102
|
+
marginBottom: `${!labelInline ? '7px' : ''}`,
|
|
103
|
+
}}
|
|
104
|
+
{...props}
|
|
105
|
+
/>
|
|
106
|
+
{required && (
|
|
107
|
+
<div
|
|
108
|
+
style={{
|
|
109
|
+
marginLeft: '4px',
|
|
110
|
+
color: `${themeColor.variant['error']}`,
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
*
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
<TextWrapper
|
|
118
|
+
required={required}
|
|
119
|
+
themeColor={defaultThemeColor}
|
|
120
|
+
textBoxStyle={textBoxStyle}
|
|
121
|
+
isValid={isValid}
|
|
122
|
+
theme={defaultStyles}
|
|
123
|
+
defaultWrapperStyle={'textbox-wrapper'}
|
|
124
|
+
{...props}
|
|
125
|
+
>
|
|
126
|
+
<Input
|
|
127
|
+
inputStyle={inputStyle}
|
|
128
|
+
type={showEye ? 'text' : 'password'}
|
|
129
|
+
defaultInputStyle={'input-wrapper'}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
<div className='input-icon' onClick={() => setShowEye(!showEye)}>
|
|
133
|
+
{showEye ? <Icon icon='eye-show' /> : <Icon icon='eye-hide' />}
|
|
134
|
+
</div>
|
|
135
|
+
</TextWrapper>
|
|
136
|
+
{errMsg.length > 0 && <div className='err-text'>{errMsg}</div>}
|
|
137
|
+
</Form>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
PasswordInput.propTypes = {
|
|
142
|
+
/**
|
|
143
|
+
* Theme props of default in-built css
|
|
144
|
+
*/
|
|
145
|
+
theme: PropTypes.object,
|
|
146
|
+
/**
|
|
147
|
+
* Color props of default theme
|
|
148
|
+
*/
|
|
149
|
+
themeColor: PropTypes.object,
|
|
150
|
+
/**
|
|
151
|
+
* Label of Input
|
|
152
|
+
*/
|
|
153
|
+
label: PropTypes.string,
|
|
154
|
+
/**
|
|
155
|
+
* Is the input required?
|
|
156
|
+
*/
|
|
157
|
+
required: PropTypes.bool,
|
|
158
|
+
/**
|
|
159
|
+
* Should label be inline with textbox?
|
|
160
|
+
*/
|
|
161
|
+
labelInline: PropTypes.bool,
|
|
162
|
+
/**
|
|
163
|
+
* Error Message
|
|
164
|
+
*/
|
|
165
|
+
errMsg: PropTypes.string,
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* custom style of textbox Wrapper
|
|
169
|
+
*/
|
|
170
|
+
textBoxStyle: PropTypes.object,
|
|
171
|
+
/**
|
|
172
|
+
* custom style of textbox input
|
|
173
|
+
*/
|
|
174
|
+
labelStyle: PropTypes.object,
|
|
175
|
+
/**
|
|
176
|
+
* custom style of textbox label
|
|
177
|
+
*/
|
|
178
|
+
inputStyle: PropTypes.object,
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
PasswordInput.defaultProps = {
|
|
182
|
+
themeColor: defaultThemeColor,
|
|
183
|
+
theme: defaultStyles,
|
|
184
|
+
label: '',
|
|
185
|
+
required: false,
|
|
186
|
+
isValid: true,
|
|
187
|
+
labelInline: false,
|
|
188
|
+
errMsg: '',
|
|
189
|
+
textBoxStyle: {},
|
|
190
|
+
labelStyle: {},
|
|
191
|
+
inputStyle: {},
|
|
192
|
+
};
|
|
@@ -1,120 +1,134 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from
|
|
2
|
-
import SignaturePad from 'react-signature-pad-wrapper'
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import SignaturePad from 'react-signature-pad-wrapper';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
import defaultStyle from '../constants/defaultStyle';
|
|
6
6
|
import getDefaultStyles from '../constants/utils';
|
|
7
|
-
import PropTypes from
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
9
|
-
import { Icon } from
|
|
9
|
+
import { Icon } from '../Icon';
|
|
10
10
|
|
|
11
11
|
const ParentDiv = styled.div`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
${({ theme, defaultParentDivStyle }) => {
|
|
12
|
+
//Set the styles from the default styles object
|
|
13
|
+
${({ theme, defaultParentDivStyle }) => {
|
|
15
14
|
return getDefaultStyles(theme, defaultParentDivStyle);
|
|
16
15
|
}}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
16
|
+
|
|
17
|
+
border: 1px solid ${({ isMyInputFocused, activeColor, defaultColor }) =>
|
|
18
|
+
isMyInputFocused ? activeColor : defaultColor};
|
|
19
|
+
|
|
20
|
+
&:focus-within {
|
|
21
|
+
border-color: ${({ activeColor }) => activeColor};
|
|
22
|
+
}
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
25
|
const WrapperDiv = styled.div`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
${({ theme, defaultWrapperDivStyle }) => {
|
|
26
|
+
//Set the styles from the default styles object
|
|
27
|
+
${({ theme, defaultWrapperDivStyle }) => {
|
|
29
28
|
return getDefaultStyles(theme, defaultWrapperDivStyle);
|
|
30
29
|
}}
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
flex-direction: ${({ signIcon }) => (signIcon ? 'column' : 'initial')};
|
|
32
|
+
width: ${({ signIcon }) =>
|
|
33
|
+
signIcon ? 'min-content' : 'calc(100% - 50px) !important'};
|
|
34
|
+
max-width: ${({ signIcon }) => (signIcon ? '42px' : '490px')};
|
|
35
|
+
border-right: 1px solid
|
|
36
|
+
${({ activeColor, defaultColor, isMyInputFocused, signIcon }) =>
|
|
37
|
+
signIcon ? (isMyInputFocused ? activeColor : defaultColor) : 'none'};
|
|
38
|
+
border-left: ${({ signIcon }) => (!signIcon ? 'none' : '')};
|
|
39
|
+
margin-left: ${({ signIcon }) => (!signIcon ? '42px' : '')};
|
|
40
|
+
position: ${({ signIcon }) => (!signIcon ? '' : 'absolute')};
|
|
42
41
|
`;
|
|
43
42
|
|
|
44
43
|
const ControllerDiv = styled.div`
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
penIcon
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
width: 39px;
|
|
45
|
+
height: 44px;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
border-bottom: ${({ penIcon, isMyInputFocused, activeColor, defaultColor }) =>
|
|
51
|
+
penIcon
|
|
52
|
+
? isMyInputFocused
|
|
53
|
+
? '1px solid ' + activeColor
|
|
54
|
+
: '1px solid ' + defaultColor
|
|
55
|
+
: ''};
|
|
56
|
+
background-color: rgba(255, 255, 255, 0.05);
|
|
57
|
+
cursor: pointer;
|
|
55
58
|
`;
|
|
56
59
|
|
|
57
|
-
|
|
58
60
|
const InputText = styled.input`
|
|
59
|
-
|
|
61
|
+
${({ theme, defaultInputStyle }) => {
|
|
60
62
|
return getDefaultStyles(theme, defaultInputStyle);
|
|
61
63
|
}}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
value.length > 0 ? 'none' :
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
64
|
+
|
|
65
|
+
border-bottom: ${({ value, defaultColor }) =>
|
|
66
|
+
value.length > 0 ? 'none' : '1px solid ' + defaultColor};
|
|
67
|
+
|
|
68
|
+
&::placeholder {
|
|
69
|
+
font-size: 17px;
|
|
70
|
+
text-align: center;
|
|
71
|
+
color: ${({ placeholderColor }) => placeholderColor};
|
|
72
|
+
font-family: 'Averta';
|
|
73
|
+
font-style: normal;
|
|
74
|
+
font-weight: normal;
|
|
75
|
+
line-height: 22px;
|
|
76
|
+
}
|
|
77
|
+
&:focus-within {
|
|
78
|
+
border: none;
|
|
79
|
+
outline: none;
|
|
80
|
+
|
|
81
|
+
::placeholder {
|
|
82
|
+
color: transparent;
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// custom styles
|
|
87
|
+
${({ customInputStyle }) => customInputStyle}
|
|
86
88
|
`;
|
|
87
89
|
|
|
88
90
|
const SignaturePadDiv = styled.div`
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
position: relative;
|
|
92
|
+
width: inherit;
|
|
93
|
+
display: flex;
|
|
94
|
+
margin: 4px;
|
|
93
95
|
`;
|
|
94
96
|
|
|
95
97
|
const IconDiv = styled.div`
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
margin-left: ${({ selected }) => selected === 'sign' ? '' : 'auto'};
|
|
98
|
+
padding-left: 2px;
|
|
99
|
+
display: flex;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
cursor: pointer;
|
|
101
102
|
`;
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
export const SignatureInput = ({
|
|
105
|
+
onChange,
|
|
106
|
+
activeColor,
|
|
107
|
+
defaultColor,
|
|
108
|
+
placeholderColor,
|
|
109
|
+
placeholderText,
|
|
110
|
+
customInputStyle,
|
|
111
|
+
pointsArray,
|
|
112
|
+
setPointsArray,
|
|
113
|
+
value,
|
|
114
|
+
setValue,
|
|
115
|
+
valueForSignatureDrawing,
|
|
116
|
+
setValueForSignatureDrawing,
|
|
117
|
+
imageURL,
|
|
118
|
+
setImageURL,
|
|
119
|
+
...props
|
|
120
|
+
}) => {
|
|
105
121
|
const [selected, setSelected] = useState('default');
|
|
106
122
|
const [isMyInputFocused, setIsMyInputFocused] = useState(false);
|
|
107
123
|
const [dirty, setDirty] = useState(false);
|
|
108
124
|
const pad = useRef(null);
|
|
109
125
|
|
|
110
|
-
// const theme = defaultStyle;
|
|
111
|
-
|
|
112
126
|
useEffect(() => {
|
|
113
127
|
if (dirty) {
|
|
114
128
|
save();
|
|
115
129
|
setValueForSignatureDrawing(pad.current);
|
|
116
130
|
}
|
|
117
|
-
}, [dirty === true])
|
|
131
|
+
}, [dirty === true]);
|
|
118
132
|
|
|
119
133
|
const onClear = () => {
|
|
120
134
|
setValue('');
|
|
@@ -124,13 +138,13 @@ export const SignatureInput = ({ onChange, activeColor, defaultColor, placeholde
|
|
|
124
138
|
}
|
|
125
139
|
setIsMyInputFocused(false);
|
|
126
140
|
setDirty(false);
|
|
127
|
-
}
|
|
141
|
+
};
|
|
128
142
|
|
|
129
143
|
const save = () => {
|
|
130
144
|
setPointsArray(pad.current.toData());
|
|
131
|
-
setImageURL(pad.current.toDataURL(
|
|
145
|
+
setImageURL(pad.current.toDataURL('image/png'));
|
|
132
146
|
return [imageURL, pointsArray];
|
|
133
|
-
}
|
|
147
|
+
};
|
|
134
148
|
|
|
135
149
|
return (
|
|
136
150
|
<ParentDiv
|
|
@@ -139,7 +153,8 @@ export const SignatureInput = ({ onChange, activeColor, defaultColor, placeholde
|
|
|
139
153
|
isMyInputFocused={isMyInputFocused}
|
|
140
154
|
selected={selected}
|
|
141
155
|
activeColor={activeColor}
|
|
142
|
-
defaultColor={defaultColor}
|
|
156
|
+
defaultColor={defaultColor}
|
|
157
|
+
>
|
|
143
158
|
<WrapperDiv
|
|
144
159
|
theme={defaultStyle}
|
|
145
160
|
defaultWrapperDivStyle={'signature-wrapper-div'}
|
|
@@ -147,27 +162,37 @@ export const SignatureInput = ({ onChange, activeColor, defaultColor, placeholde
|
|
|
147
162
|
defaultColor={defaultColor}
|
|
148
163
|
selected={selected}
|
|
149
164
|
isMyInputFocused={isMyInputFocused}
|
|
150
|
-
signIcon={true}
|
|
165
|
+
signIcon={true}
|
|
166
|
+
>
|
|
151
167
|
<ControllerDiv
|
|
152
168
|
activeColor={activeColor}
|
|
153
169
|
defaultColor={defaultColor}
|
|
154
170
|
isMyInputFocused={isMyInputFocused}
|
|
155
171
|
penIcon={true}
|
|
156
|
-
onClick={() => {
|
|
172
|
+
onClick={() => {
|
|
173
|
+
setSelected('default');
|
|
174
|
+
onClear();
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
157
177
|
<Icon
|
|
158
178
|
icon='pen-icon'
|
|
159
|
-
color={selected === 'default' ?
|
|
160
|
-
|
|
179
|
+
color={selected === 'default' ? activeColor : 'black'}
|
|
180
|
+
/>
|
|
161
181
|
</ControllerDiv>
|
|
162
182
|
<ControllerDiv
|
|
163
|
-
activeColor={activeColor}
|
|
183
|
+
activeColor={activeColor}
|
|
184
|
+
defaultColor={defaultColor}
|
|
164
185
|
isMyInputFocused={isMyInputFocused}
|
|
165
186
|
penIcon={false}
|
|
166
|
-
onClick={() => {
|
|
187
|
+
onClick={() => {
|
|
188
|
+
setSelected('sign');
|
|
189
|
+
onClear();
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
167
192
|
<Icon
|
|
168
193
|
icon='sign-icon'
|
|
169
|
-
color={selected !== 'default' ?
|
|
170
|
-
|
|
194
|
+
color={selected !== 'default' ? activeColor : 'black'}
|
|
195
|
+
/>
|
|
171
196
|
</ControllerDiv>
|
|
172
197
|
</WrapperDiv>
|
|
173
198
|
<WrapperDiv
|
|
@@ -178,10 +203,14 @@ export const SignatureInput = ({ onChange, activeColor, defaultColor, placeholde
|
|
|
178
203
|
selected={selected}
|
|
179
204
|
isMyInputFocused={isMyInputFocused}
|
|
180
205
|
signIcon={false}
|
|
181
|
-
onTouchStart={() => {
|
|
182
|
-
|
|
206
|
+
onTouchStart={() => {
|
|
207
|
+
console.log('touchstart');
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
{selected === 'default' ? (
|
|
183
211
|
<InputText
|
|
184
|
-
theme={defaultStyle}
|
|
212
|
+
theme={defaultStyle}
|
|
213
|
+
defaultInputStyle={'signature-input-text'}
|
|
185
214
|
placeholder={placeholderText}
|
|
186
215
|
placeholderColor={placeholderColor}
|
|
187
216
|
customInputStyle={customInputStyle}
|
|
@@ -189,29 +218,34 @@ export const SignatureInput = ({ onChange, activeColor, defaultColor, placeholde
|
|
|
189
218
|
onFocus={() => setIsMyInputFocused(true)}
|
|
190
219
|
value={value}
|
|
191
220
|
defaultColor={defaultColor}
|
|
192
|
-
onChange={(e) => setValue(e.target.value)}
|
|
193
|
-
|
|
221
|
+
onChange={(e) => setValue(e.target.value)}
|
|
222
|
+
/>
|
|
223
|
+
) : (
|
|
224
|
+
<SignaturePadDiv
|
|
194
225
|
onMouseEnter={() => setIsMyInputFocused(true)}
|
|
195
226
|
onMouseLeave={() => setIsMyInputFocused(false)}
|
|
196
|
-
onClick={() => {
|
|
227
|
+
onClick={() => {
|
|
228
|
+
setDirty(true);
|
|
229
|
+
save();
|
|
230
|
+
}}
|
|
231
|
+
>
|
|
197
232
|
<SignaturePad
|
|
198
233
|
ref={pad}
|
|
199
234
|
redrawOnResize
|
|
200
235
|
height={75}
|
|
201
|
-
options={{ minWidth: 1, maxWidth: 1, penColor: '#444444' }}
|
|
236
|
+
options={{ minWidth: 1, maxWidth: 1, penColor: '#444444' }}
|
|
237
|
+
/>
|
|
202
238
|
</SignaturePadDiv>
|
|
203
|
-
}
|
|
204
|
-
{(value || dirty) &&
|
|
205
|
-
<
|
|
206
|
-
icon='cross-icon'
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
</IconDiv>
|
|
210
|
-
}
|
|
239
|
+
)}
|
|
240
|
+
{(value || dirty) && (
|
|
241
|
+
<IconDiv selected={selected} onClick={() => onClear()}>
|
|
242
|
+
<Icon icon='cross-icon' color={defaultColor} />
|
|
243
|
+
</IconDiv>
|
|
244
|
+
)}
|
|
211
245
|
</WrapperDiv>
|
|
212
246
|
</ParentDiv>
|
|
213
|
-
)
|
|
214
|
-
}
|
|
247
|
+
);
|
|
248
|
+
};
|
|
215
249
|
|
|
216
250
|
SignatureInput.propTypes = {
|
|
217
251
|
/**
|
|
@@ -257,9 +291,8 @@ SignatureInput.propTypes = {
|
|
|
257
291
|
/**
|
|
258
292
|
* Function that sets Image url of the Signature drawing
|
|
259
293
|
*/
|
|
260
|
-
setImageURL: PropTypes.func
|
|
261
|
-
|
|
262
|
-
}
|
|
294
|
+
setImageURL: PropTypes.func,
|
|
295
|
+
};
|
|
263
296
|
|
|
264
297
|
SignatureInput.defaultProps = {
|
|
265
298
|
activeColor: `${defaultThemeColor.primary['primary-1']}`,
|
|
@@ -269,10 +302,10 @@ SignatureInput.defaultProps = {
|
|
|
269
302
|
placeholderText: 'Type your signature here',
|
|
270
303
|
pointsArray: null,
|
|
271
304
|
setPointsArray: () => { },
|
|
272
|
-
value:
|
|
305
|
+
value: '',
|
|
273
306
|
setValue: () => { },
|
|
274
307
|
imageURL: '',
|
|
275
308
|
setImageURL: () => { },
|
|
276
309
|
setValueForSignatureDrawing: () => { },
|
|
277
|
-
}
|
|
310
|
+
};
|
|
278
311
|
|
|
@@ -6,7 +6,6 @@ import defaultStyles from '../constants/defaultStyle';
|
|
|
6
6
|
import getDefaultStyles from '../constants/utils';
|
|
7
7
|
import { Label } from '../Label';
|
|
8
8
|
|
|
9
|
-
const border = `#D4D7E3`;
|
|
10
9
|
|
|
11
10
|
const TextWrapper = styled.div`
|
|
12
11
|
//Set the styles from the default styles object
|
|
@@ -15,7 +14,7 @@ const TextWrapper = styled.div`
|
|
|
15
14
|
}}
|
|
16
15
|
|
|
17
16
|
border: ${({ isValid, themeColor }) => !isValid ? '1px solid ' + themeColor.variant['error'] :
|
|
18
|
-
'1px solid ' + border};
|
|
17
|
+
'1px solid ' + defaultThemeColor.border};
|
|
19
18
|
|
|
20
19
|
.input-icon svg path {
|
|
21
20
|
fill: ${({ themeColor }) => themeColor.variant['neutral-1']};
|
|
@@ -53,7 +52,7 @@ const Input = styled.textarea`
|
|
|
53
52
|
|
|
54
53
|
const inline = css`
|
|
55
54
|
display: flex;
|
|
56
|
-
gap:
|
|
55
|
+
gap: 7px;
|
|
57
56
|
align-items: center;
|
|
58
57
|
`
|
|
59
58
|
|
|
@@ -90,7 +89,7 @@ export const TextArea = React.forwardRef(({ themeColor, customStylesForm, textAr
|
|
|
90
89
|
errMsg={errMsg}
|
|
91
90
|
style={{
|
|
92
91
|
'display': 'flex',
|
|
93
|
-
'paddingBottom': `${!labelInline ? '
|
|
92
|
+
'paddingBottom': `${!labelInline ? '7px' : ''}`,
|
|
94
93
|
}}
|
|
95
94
|
{...props} />
|
|
96
95
|
{required && <div style={{
|
|
@@ -6,7 +6,6 @@ import defaultStyles from '../constants/defaultStyle';
|
|
|
6
6
|
import getDefaultStyles from '../constants/utils';
|
|
7
7
|
import { Label } from '../Label';
|
|
8
8
|
|
|
9
|
-
const border = `#D4D7E3`;
|
|
10
9
|
|
|
11
10
|
const TextWrapper = styled.div`
|
|
12
11
|
//Set the styles from the default styles object
|
|
@@ -15,7 +14,7 @@ const TextWrapper = styled.div`
|
|
|
15
14
|
}}
|
|
16
15
|
|
|
17
16
|
border: ${({ isValid, themeColor }) => !isValid ? '1px solid ' + themeColor.variant['error'] :
|
|
18
|
-
'1px solid ' + border};
|
|
17
|
+
'1px solid ' + defaultThemeColor.border};
|
|
19
18
|
|
|
20
19
|
.input-icon svg path {
|
|
21
20
|
fill: ${({ themeColor }) => themeColor.variant['neutral-1']};
|
|
@@ -36,6 +35,8 @@ const TextWrapper = styled.div`
|
|
|
36
35
|
`;
|
|
37
36
|
|
|
38
37
|
const Input = styled.input`
|
|
38
|
+
width:inherit;
|
|
39
|
+
|
|
39
40
|
//Set the styles from the default styles object
|
|
40
41
|
${({ theme, defaultInputStyle }) => {
|
|
41
42
|
return getDefaultStyles(theme, defaultInputStyle);
|
|
@@ -52,7 +53,7 @@ const Input = styled.input`
|
|
|
52
53
|
|
|
53
54
|
const inline = css`
|
|
54
55
|
display: flex;
|
|
55
|
-
|
|
56
|
+
gap: 7px;
|
|
56
57
|
align-items: center;
|
|
57
58
|
`
|
|
58
59
|
|
|
@@ -69,13 +70,11 @@ Form.defaultProps = {
|
|
|
69
70
|
themeColor: defaultThemeColor,
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
|
|
73
73
|
export const TextInput = ({ themeColor, textBoxStyle, labelStyle, inputStyle, errMsg, required, label, labelInline, iconBefore, iconAfter, isValid, type, ...props }) => {
|
|
74
74
|
return (
|
|
75
75
|
<Form labelInline={labelInline} {...props}>
|
|
76
76
|
<div style={{ display: 'flex' }}>
|
|
77
77
|
<Label
|
|
78
|
-
themeColor={defaultThemeColor}
|
|
79
78
|
customStyles={labelStyle}
|
|
80
79
|
type={'label-text'}
|
|
81
80
|
labelInline={labelInline}
|
|
@@ -83,7 +82,7 @@ export const TextInput = ({ themeColor, textBoxStyle, labelStyle, inputStyle, er
|
|
|
83
82
|
errMsg={errMsg}
|
|
84
83
|
style={{
|
|
85
84
|
'display': 'flex',
|
|
86
|
-
'
|
|
85
|
+
'marginBottom': `${!labelInline ? '7px' : ''}`,
|
|
87
86
|
}}
|
|
88
87
|
{...props} />
|
|
89
88
|
{required && <div style={{
|
|
@@ -179,4 +178,4 @@ TextInput.defaultProps = {
|
|
|
179
178
|
labelStyle: {},
|
|
180
179
|
inputStyle: {},
|
|
181
180
|
type: 'text'
|
|
182
|
-
}
|
|
181
|
+
}
|