groundfloor-react-ui 1.2.7 → 1.2.9
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/components/Inputs/CheckBoxInput.js +16 -2
- package/components/Inputs/DropdownSelect.js +30 -31
- package/components/Inputs/NumericInput.js +16 -5
- package/components/Inputs/PasswordInput.js +57 -32
- package/components/Inputs/TextInput.js +28 -12
- package/components/Inputs/ToggleSwitch.js +41 -9
- package/components/Sidebar/Navbar.js +6 -3
- package/components/Sidebar/Sidebar.js +6 -0
- package/components/constants/defaultStyle.js +6 -1
- package/dist/index.es.js +169 -148
- package/dist/index.js +200 -179
- package/package.json +1 -1
|
@@ -71,6 +71,8 @@ CheckBoxInner.defaultProps = {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
const OptionText = styled.span`
|
|
74
|
+
word-break: break-all;
|
|
75
|
+
|
|
74
76
|
//Set the styles from the default styles object
|
|
75
77
|
${({ inBuiltCss, type }) => {
|
|
76
78
|
return getDefaultStyles(inBuiltCss, type);
|
|
@@ -83,7 +85,7 @@ const OptionText = styled.span`
|
|
|
83
85
|
else if (!checked && !defaultTextColor) return theme.neutral['neutral-2'];
|
|
84
86
|
}};
|
|
85
87
|
|
|
86
|
-
margin-right: ${({ inline }) => (inline ? '30px' : '
|
|
88
|
+
margin-right: ${({ inline }) => (inline ? '30px' : '10px')};
|
|
87
89
|
|
|
88
90
|
// custom styles
|
|
89
91
|
${({ optionTextStyle }) => optionTextStyle}
|
|
@@ -96,9 +98,9 @@ const WrapperDiv = styled.label`
|
|
|
96
98
|
width: fit-content;
|
|
97
99
|
margin-bottom: ${({ inline }) => (!inline ? '18px !important' : '')};
|
|
98
100
|
cursor: pointer;
|
|
99
|
-
align-items: center;
|
|
100
101
|
display: flex;
|
|
101
102
|
gap: 10px;
|
|
103
|
+
align-items: start;
|
|
102
104
|
|
|
103
105
|
// custom styles
|
|
104
106
|
${({ wrapperStyles }) => wrapperStyles}
|
|
@@ -293,6 +295,16 @@ CheckBoxInput.propTypes = {
|
|
|
293
295
|
inline: PropTypes.bool,
|
|
294
296
|
/**
|
|
295
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
|
+
]
|
|
296
308
|
*/
|
|
297
309
|
options: PropTypes.array,
|
|
298
310
|
/**
|
|
@@ -311,6 +323,8 @@ CheckBoxInput.propTypes = {
|
|
|
311
323
|
* Wrapper styles
|
|
312
324
|
*/
|
|
313
325
|
wrapperStyles: PropTypes.object,
|
|
326
|
+
|
|
327
|
+
|
|
314
328
|
};
|
|
315
329
|
|
|
316
330
|
CheckBoxInput.defaultProps = {
|
|
@@ -30,6 +30,7 @@ const Wrapper = styled.div`
|
|
|
30
30
|
padding-top:0px;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
|
|
33
34
|
.master-dropdown__single-value {
|
|
34
35
|
.input-label {
|
|
35
36
|
max-width: 250px;
|
|
@@ -123,7 +124,7 @@ const Wrapper = styled.div`
|
|
|
123
124
|
white-space: nowrap;
|
|
124
125
|
overflow: hidden;
|
|
125
126
|
text-overflow: ellipsis;
|
|
126
|
-
|
|
127
|
+
width: 57%;
|
|
127
128
|
}
|
|
128
129
|
.text-more-alt{
|
|
129
130
|
font-size:12px;
|
|
@@ -156,6 +157,11 @@ const Wrapper = styled.div`
|
|
|
156
157
|
.new-select__control--is-focused {
|
|
157
158
|
border: 1px solid ${({ theme }) => theme.primary['primary-1']};
|
|
158
159
|
}
|
|
160
|
+
|
|
161
|
+
.css-ry76bm-singleValue {
|
|
162
|
+
margin-right: 5px;
|
|
163
|
+
max-width: 80%;
|
|
164
|
+
}
|
|
159
165
|
`;
|
|
160
166
|
|
|
161
167
|
Wrapper.defaultProps = {
|
|
@@ -179,6 +185,23 @@ const IconDiv = styled.div`
|
|
|
179
185
|
cursor: pointer;
|
|
180
186
|
`;
|
|
181
187
|
|
|
188
|
+
const LeftIcon = ({ getValue, children, ...props }) => {
|
|
189
|
+
const len = getValue().length;
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<components.ValueContainer {...props}>
|
|
193
|
+
{/* {leftIcon === '' ? null : (
|
|
194
|
+
|
|
195
|
+
<div style={{ marginRight: '6px', marginTop: '-6px' }}><Icon icon={leftIcon} color={leftIconColor} size={leftIconSize} /></div>
|
|
196
|
+
|
|
197
|
+
)} */}
|
|
198
|
+
|
|
199
|
+
{children}
|
|
200
|
+
{len > 1 && <span className={`text-more-alt`}>& {len - 1} more</span>}
|
|
201
|
+
</components.ValueContainer>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
182
205
|
export const DropdownSelect = ({
|
|
183
206
|
label,
|
|
184
207
|
labelStyle,
|
|
@@ -198,7 +221,6 @@ export const DropdownSelect = ({
|
|
|
198
221
|
isRequired,
|
|
199
222
|
dropdownType,
|
|
200
223
|
isDisabled,
|
|
201
|
-
|
|
202
224
|
isLoading,
|
|
203
225
|
id,
|
|
204
226
|
iconName,
|
|
@@ -240,32 +262,6 @@ export const DropdownSelect = ({
|
|
|
240
262
|
);
|
|
241
263
|
};
|
|
242
264
|
|
|
243
|
-
const LeftIcon = ({ getValue, children, ...props }) => {
|
|
244
|
-
const len = getValue().length;
|
|
245
|
-
|
|
246
|
-
return (
|
|
247
|
-
<components.ValueContainer {...props}>
|
|
248
|
-
{leftIcon === '' ? null : (
|
|
249
|
-
<IconDiv
|
|
250
|
-
style={{
|
|
251
|
-
paddingTop: '10px',
|
|
252
|
-
paddingRight: '8px',
|
|
253
|
-
marginLeft: '0',
|
|
254
|
-
marginTop: '-16px',
|
|
255
|
-
}}
|
|
256
|
-
>
|
|
257
|
-
<Icon icon={leftIcon} color={leftIconColor} size={leftIconSize} />
|
|
258
|
-
</IconDiv>
|
|
259
|
-
)}
|
|
260
|
-
|
|
261
|
-
{children}
|
|
262
|
-
{len > 1 && <span className={`text-more-alt`}>& {len - 1} more</span>}
|
|
263
|
-
</components.ValueContainer>
|
|
264
|
-
);
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
265
|
const Option = (p) => {
|
|
270
266
|
const checkboxStyle = {
|
|
271
267
|
width: '15px',
|
|
@@ -311,7 +307,9 @@ export const DropdownSelect = ({
|
|
|
311
307
|
|
|
312
308
|
const MultiValue = ({ index, ...p }) => {
|
|
313
309
|
const firstSelected = p?.data?.label || 'Select';
|
|
314
|
-
return
|
|
310
|
+
return (
|
|
311
|
+
!index && <span className='text-main-alt-value'>{firstSelected}</span>
|
|
312
|
+
);
|
|
315
313
|
};
|
|
316
314
|
|
|
317
315
|
const stylesComp = {
|
|
@@ -469,6 +467,7 @@ export const DropdownSelect = ({
|
|
|
469
467
|
DropdownIndicator,
|
|
470
468
|
ValueContainer: LeftIcon,
|
|
471
469
|
// ValueContainer,
|
|
470
|
+
|
|
472
471
|
IndicatorSeparator: () => null,
|
|
473
472
|
ClearIndicator,
|
|
474
473
|
}}
|
|
@@ -654,8 +653,8 @@ DropdownSelect.propTypes = {
|
|
|
654
653
|
*/
|
|
655
654
|
leftIconSize: PropTypes.number,
|
|
656
655
|
/**
|
|
657
|
-
|
|
658
|
-
|
|
656
|
+
* to show or hide indicator
|
|
657
|
+
*/
|
|
659
658
|
showIndicator: PropTypes.bool,
|
|
660
659
|
};
|
|
661
660
|
|
|
@@ -67,6 +67,8 @@ const Label = styled.label`
|
|
|
67
67
|
margin-right: ${({ labelInline }) => (labelInline ? '7px' : '')};
|
|
68
68
|
padding-bottom: 0px;
|
|
69
69
|
color: ${({ theme }) => theme.variant['neutral-2']};
|
|
70
|
+
|
|
71
|
+
${({ labelStyle }) => labelStyle}
|
|
70
72
|
`;
|
|
71
73
|
|
|
72
74
|
Label.defaultProps = {
|
|
@@ -98,6 +100,7 @@ export const NumericInput = ({
|
|
|
98
100
|
onChange,
|
|
99
101
|
theme,
|
|
100
102
|
id,
|
|
103
|
+
labelStyle,
|
|
101
104
|
...props
|
|
102
105
|
}) => {
|
|
103
106
|
const handleChange = (e) => {
|
|
@@ -108,9 +111,12 @@ export const NumericInput = ({
|
|
|
108
111
|
}
|
|
109
112
|
};
|
|
110
113
|
|
|
114
|
+
console.log(labelStyle);
|
|
115
|
+
|
|
111
116
|
return (
|
|
112
117
|
<Form {...props}>
|
|
113
|
-
{label.length > 0 && <Label {
|
|
118
|
+
{label.length > 0 && <Label labelStyle={labelStyle}
|
|
119
|
+
>{label}</Label>}
|
|
114
120
|
<div>
|
|
115
121
|
<TextBox {...props}>
|
|
116
122
|
<div className='input-icon'>{iconBefore}</div>
|
|
@@ -122,7 +128,7 @@ export const NumericInput = ({
|
|
|
122
128
|
type='number'
|
|
123
129
|
id={id}
|
|
124
130
|
/>
|
|
125
|
-
<div className='input-icon'>{iconAfter}</div>
|
|
131
|
+
<div className='input-icon' style={{ position: 'absolute', right: '7px' }}>{iconAfter}</div>
|
|
126
132
|
</TextBox>
|
|
127
133
|
</div>
|
|
128
134
|
</Form>
|
|
@@ -151,9 +157,13 @@ NumericInput.propTypes = {
|
|
|
151
157
|
*/
|
|
152
158
|
inputStyle: PropTypes.object,
|
|
153
159
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
* id of the number input
|
|
161
|
+
*/
|
|
156
162
|
id: PropTypes.string,
|
|
163
|
+
/**
|
|
164
|
+
* custom style of label element
|
|
165
|
+
*/
|
|
166
|
+
labelStyle: PropTypes.object,
|
|
157
167
|
};
|
|
158
168
|
|
|
159
169
|
NumericInput.defaultProps = {
|
|
@@ -162,5 +172,6 @@ NumericInput.defaultProps = {
|
|
|
162
172
|
labelInline: false,
|
|
163
173
|
inputStyle: {},
|
|
164
174
|
inputValue: null,
|
|
165
|
-
id: ''
|
|
175
|
+
id: '',
|
|
176
|
+
labelStyle: {},
|
|
166
177
|
};
|
|
@@ -44,7 +44,7 @@ TextWrapper.defaultProps = {
|
|
|
44
44
|
|
|
45
45
|
const Input = styled.input`
|
|
46
46
|
width: 85%;
|
|
47
|
-
-webkit-text-security: ${({ showEye }) => showEye ? 'none' : 'disc'}
|
|
47
|
+
-webkit-text-security: ${({ showEye }) => (showEye ? 'none' : 'disc')};
|
|
48
48
|
|
|
49
49
|
//Set the styles from the default styles object
|
|
50
50
|
${({ inBuiltCss, defaultInputStyle }) => {
|
|
@@ -57,7 +57,6 @@ const Input = styled.input`
|
|
|
57
57
|
.sc-furwcr bxRAoq {
|
|
58
58
|
color: ${({ theme }) => theme.variant['neutral-3']};
|
|
59
59
|
}
|
|
60
|
-
|
|
61
60
|
`;
|
|
62
61
|
Input.defaultProps = {
|
|
63
62
|
theme: defaultThemeColor,
|
|
@@ -71,13 +70,12 @@ const inline = css`
|
|
|
71
70
|
const Form = styled.div`
|
|
72
71
|
${({ labelInline }) => (labelInline ? inline : null)}
|
|
73
72
|
.err-text {
|
|
74
|
-
color: ${({
|
|
73
|
+
color: ${({ errMsgColor }) => errMsgColor};
|
|
75
74
|
margin-top: 5px;
|
|
76
75
|
font-size: 10px;
|
|
77
76
|
}
|
|
78
77
|
`;
|
|
79
78
|
|
|
80
|
-
|
|
81
79
|
Form.defaultProps = {
|
|
82
80
|
theme: defaultThemeColor,
|
|
83
81
|
};
|
|
@@ -96,12 +94,25 @@ export const PasswordInput = ({
|
|
|
96
94
|
rulesStyle,
|
|
97
95
|
id,
|
|
98
96
|
showHideIcon,
|
|
97
|
+
errMsgColor,
|
|
99
98
|
...props
|
|
100
99
|
}) => {
|
|
101
100
|
const [showEye, setShowEye] = useState(false);
|
|
102
101
|
|
|
103
102
|
return (
|
|
104
|
-
<Form
|
|
103
|
+
<Form
|
|
104
|
+
onPaste={(e) => {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
return false;
|
|
107
|
+
}}
|
|
108
|
+
onCopy={(e) => {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
return false;
|
|
111
|
+
}}
|
|
112
|
+
labelInline={labelInline}
|
|
113
|
+
inBuiltCss={defaultStyles}
|
|
114
|
+
errMsgColor={errMsgColor}
|
|
115
|
+
{...props}
|
|
105
116
|
>
|
|
106
117
|
<div style={{ display: 'flex' }}>
|
|
107
118
|
<Label
|
|
@@ -135,34 +146,48 @@ export const PasswordInput = ({
|
|
|
135
146
|
alignItems: 'start',
|
|
136
147
|
}}
|
|
137
148
|
>
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
textBoxStyle={textBoxStyle}
|
|
142
|
-
isValid={isValid}
|
|
143
|
-
defaultWrapperStyle={'textbox-wrapper'}
|
|
144
|
-
inBuiltCss={defaultStyles}
|
|
145
|
-
{...props}
|
|
146
|
-
>
|
|
147
|
-
<Input
|
|
148
|
-
inputStyle={inputStyle}
|
|
149
|
-
type={'text'}
|
|
150
|
-
id={id}
|
|
151
|
-
showEye={showEye}
|
|
149
|
+
<div style={{ width: '100%' }}>
|
|
150
|
+
<TextWrapper
|
|
151
|
+
required={required}
|
|
152
152
|
theme={theme}
|
|
153
|
-
|
|
153
|
+
textBoxStyle={textBoxStyle}
|
|
154
|
+
isValid={isValid}
|
|
155
|
+
defaultWrapperStyle={'textbox-wrapper'}
|
|
154
156
|
inBuiltCss={defaultStyles}
|
|
155
157
|
{...props}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
>
|
|
159
|
+
<Input
|
|
160
|
+
inputStyle={inputStyle}
|
|
161
|
+
type={'text'}
|
|
162
|
+
id={id}
|
|
163
|
+
showEye={showEye}
|
|
164
|
+
theme={theme}
|
|
165
|
+
defaultInputStyle={'input-wrapper'}
|
|
166
|
+
inBuiltCss={defaultStyles}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
{showHideIcon === true ? (
|
|
170
|
+
<div
|
|
171
|
+
className='input-icon'
|
|
172
|
+
onClick={() => setShowEye(!showEye)}
|
|
173
|
+
style={{ position: 'absolute', right: '7px' }}
|
|
174
|
+
>
|
|
175
|
+
{showEye ? <Icon icon='eye-show' /> : <Icon icon='eye-hide' />}
|
|
176
|
+
</div>
|
|
177
|
+
) : (
|
|
178
|
+
''
|
|
179
|
+
)}
|
|
180
|
+
</TextWrapper>
|
|
181
|
+
{errMsg.length > 0 && <div className='err-text'>{errMsg}</div>}
|
|
182
|
+
</div>
|
|
183
|
+
{passwordRules ? (
|
|
184
|
+
<div style={{ ...rulesStyle, marginLeft: '5px' }}>
|
|
185
|
+
{passwordRules}
|
|
186
|
+
</div>
|
|
187
|
+
) : (
|
|
188
|
+
''
|
|
189
|
+
)}
|
|
164
190
|
</div>
|
|
165
|
-
{errMsg.length > 0 && <div className='err-text'>{errMsg}</div>}
|
|
166
191
|
</Form>
|
|
167
192
|
);
|
|
168
193
|
};
|
|
@@ -237,6 +262,6 @@ PasswordInput.defaultProps = {
|
|
|
237
262
|
passwordRules: '',
|
|
238
263
|
rulesStyle: {},
|
|
239
264
|
id: '',
|
|
240
|
-
showHideIcon: true
|
|
241
|
-
|
|
242
|
-
|
|
265
|
+
showHideIcon: true,
|
|
266
|
+
errMsgColor: defaultThemeColor.variant['error'],
|
|
267
|
+
};
|
|
@@ -33,7 +33,8 @@ const TextWrapper = styled.div`
|
|
|
33
33
|
// custom styles
|
|
34
34
|
${({ textBoxStyle }) => textBoxStyle}
|
|
35
35
|
|
|
36
|
-
background-color: ${({ isDisabled, theme }) =>
|
|
36
|
+
background-color: ${({ isDisabled, theme }) =>
|
|
37
|
+
isDisabled ? theme.variant['neutral-5'] : theme.bgColor}
|
|
37
38
|
`;
|
|
38
39
|
|
|
39
40
|
const Input = styled.input`
|
|
@@ -49,7 +50,8 @@ const Input = styled.input`
|
|
|
49
50
|
.sc-furwcr bxRAoq {
|
|
50
51
|
color: ${defaultThemeColor.variant['neutral-3']};
|
|
51
52
|
}
|
|
52
|
-
background-color:
|
|
53
|
+
background-color: ${({ isDisabled, theme }) =>
|
|
54
|
+
isDisabled ? theme.variant['neutral-5'] : theme.bgColor};
|
|
53
55
|
`;
|
|
54
56
|
|
|
55
57
|
const inline = css`
|
|
@@ -61,7 +63,7 @@ const inline = css`
|
|
|
61
63
|
const Form = styled.div`
|
|
62
64
|
${({ labelInline }) => (labelInline ? inline : null)}
|
|
63
65
|
.err-text {
|
|
64
|
-
color: ${({
|
|
66
|
+
color: ${({ errMsgColor }) => errMsgColor};
|
|
65
67
|
margin-top: 5px;
|
|
66
68
|
font-size: 10px;
|
|
67
69
|
}
|
|
@@ -86,11 +88,16 @@ export const TextInput = ({
|
|
|
86
88
|
theme,
|
|
87
89
|
isDisabled,
|
|
88
90
|
id,
|
|
91
|
+
errMsgColor,
|
|
89
92
|
...props
|
|
90
93
|
}) => {
|
|
91
|
-
|
|
92
94
|
return (
|
|
93
|
-
<Form
|
|
95
|
+
<Form
|
|
96
|
+
labelInline={labelInline}
|
|
97
|
+
{...props}
|
|
98
|
+
theme={theme}
|
|
99
|
+
errMsgColor={errMsgColor}
|
|
100
|
+
>
|
|
94
101
|
<div style={{ display: 'flex' }}>
|
|
95
102
|
<Label
|
|
96
103
|
customStyles={labelStyle}
|
|
@@ -137,7 +144,12 @@ export const TextInput = ({
|
|
|
137
144
|
disabled={isDisabled}
|
|
138
145
|
{...props}
|
|
139
146
|
/>
|
|
140
|
-
<div
|
|
147
|
+
<div
|
|
148
|
+
className='input-icon'
|
|
149
|
+
style={{ position: 'absolute', right: '7px' }}
|
|
150
|
+
>
|
|
151
|
+
{iconAfter}
|
|
152
|
+
</div>
|
|
141
153
|
</TextWrapper>
|
|
142
154
|
{errMsg.length > 0 && <div className='err-text'>{errMsg}</div>}
|
|
143
155
|
</Form>
|
|
@@ -190,18 +202,21 @@ TextInput.propTypes = {
|
|
|
190
202
|
*/
|
|
191
203
|
type: PropTypes.string,
|
|
192
204
|
/**
|
|
193
|
-
|
|
194
|
-
|
|
205
|
+
* input field disabled or not
|
|
206
|
+
*/
|
|
195
207
|
isDisabled: PropTypes.bool,
|
|
196
208
|
/**
|
|
197
|
-
|
|
198
|
-
|
|
209
|
+
* receives theme object
|
|
210
|
+
*/
|
|
199
211
|
theme: PropTypes.object,
|
|
200
212
|
/**
|
|
201
213
|
* id of the text input
|
|
202
214
|
*/
|
|
203
215
|
id: PropTypes.string,
|
|
204
|
-
|
|
216
|
+
/**
|
|
217
|
+
* To customize the color of error message
|
|
218
|
+
*/
|
|
219
|
+
errMsgColor: PropTypes.string,
|
|
205
220
|
};
|
|
206
221
|
|
|
207
222
|
Input.defaultProps = {
|
|
@@ -231,5 +246,6 @@ TextInput.defaultProps = {
|
|
|
231
246
|
inputStyle: {},
|
|
232
247
|
type: 'text',
|
|
233
248
|
isDisabled: false,
|
|
234
|
-
id: ''
|
|
249
|
+
id: '',
|
|
250
|
+
errMsgColor: defaultThemeColor.variant['error'],
|
|
235
251
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import styled, { useTheme } from 'styled-components';
|
|
4
3
|
import defaultStyles from '../constants/defaultStyle';
|
|
5
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
@@ -11,6 +10,11 @@ const CheckBoxWrapper = styled.div`
|
|
|
11
10
|
}}
|
|
12
11
|
`;
|
|
13
12
|
const CheckBoxLabel = styled.label`
|
|
13
|
+
|
|
14
|
+
left: ${({ labelPosition }) => labelPosition === 'right' ? 'initial' : '50px'};
|
|
15
|
+
margin-right: ${({ labelPosition }) => labelPosition === 'left' ? '30px' : '0px'};
|
|
16
|
+
|
|
17
|
+
|
|
14
18
|
//Set the styles from the default styles object
|
|
15
19
|
${({ inBuiltCss, defaultCheckBoxLabelStyle }) => {
|
|
16
20
|
return getDefaultStyles(inBuiltCss, defaultCheckBoxLabelStyle);
|
|
@@ -47,13 +51,21 @@ const CheckBox = styled.input.attrs({ type: 'checkbox' })`
|
|
|
47
51
|
width: 45px;
|
|
48
52
|
height: 22px;
|
|
49
53
|
cursor: pointer;
|
|
54
|
+
position: ${({ labelPosition }) => labelPosition === 'right' ? 'initial' : 'absolute'};
|
|
55
|
+
left: ${({ labelPosition }) => labelPosition === 'right' ? 'initial' : '50px'};
|
|
56
|
+
|
|
57
|
+
|
|
50
58
|
`;
|
|
51
59
|
|
|
52
60
|
const OptionText = styled.span`
|
|
61
|
+
|
|
62
|
+
margin-right: ${({ labelPosition }) => labelPosition === 'right' ? '30px' : '30px'};
|
|
63
|
+
z-index:10000;
|
|
53
64
|
//Set the styles from the default styles object
|
|
54
65
|
${({ inBuiltCss, defaultOptionTextStyle }) => {
|
|
55
66
|
return getDefaultStyles(inBuiltCss, defaultOptionTextStyle);
|
|
56
|
-
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
57
69
|
|
|
58
70
|
// custom styles
|
|
59
71
|
${({ optionStyle }) => optionStyle}
|
|
@@ -70,6 +82,7 @@ export const ToggleSwitch = ({
|
|
|
70
82
|
trueLabel,
|
|
71
83
|
falseLabel,
|
|
72
84
|
optionStyle,
|
|
85
|
+
labelPosition,
|
|
73
86
|
id,
|
|
74
87
|
...props
|
|
75
88
|
}) => {
|
|
@@ -81,9 +94,20 @@ export const ToggleSwitch = ({
|
|
|
81
94
|
defaultCheckBoxWrapperStyle={'toggle-switch-wrapper'}
|
|
82
95
|
{...props}
|
|
83
96
|
>
|
|
97
|
+
{labelPosition === 'left' && <OptionText
|
|
98
|
+
optionStyle={optionStyle}
|
|
99
|
+
inBuiltCss={defaultStyles}
|
|
100
|
+
labelPosition={labelPosition}
|
|
101
|
+
defaultOptionTextStyle={'toggle-switch-option-text'}
|
|
102
|
+
{...props}
|
|
103
|
+
>
|
|
104
|
+
{checked ? trueLabel : falseLabel}
|
|
105
|
+
</OptionText>}
|
|
106
|
+
|
|
84
107
|
<CheckBox
|
|
85
108
|
{...props}
|
|
86
|
-
|
|
109
|
+
labelPosition={labelPosition}
|
|
110
|
+
id={id}
|
|
87
111
|
inBuiltCss={defaultStyles}
|
|
88
112
|
defaultCheckBoxStyle={'toggle-switch-checkbox'}
|
|
89
113
|
onClick={() => {
|
|
@@ -91,9 +115,11 @@ export const ToggleSwitch = ({
|
|
|
91
115
|
}}
|
|
92
116
|
isChecked={checked}
|
|
93
117
|
/>
|
|
118
|
+
|
|
94
119
|
<CheckBoxLabel
|
|
95
120
|
{...props}
|
|
96
|
-
|
|
121
|
+
labelPosition={labelPosition}
|
|
122
|
+
htmlFor={id}
|
|
97
123
|
customToggleBoxStyle={customToggleBoxStyle}
|
|
98
124
|
customSwitchStyle={customSwitchStyle}
|
|
99
125
|
disabledColor={disabledColor}
|
|
@@ -104,14 +130,15 @@ export const ToggleSwitch = ({
|
|
|
104
130
|
checked={checked}
|
|
105
131
|
theme={activeTheme}
|
|
106
132
|
/>
|
|
107
|
-
<OptionText
|
|
133
|
+
{labelPosition === 'right' && <OptionText
|
|
108
134
|
optionStyle={optionStyle}
|
|
109
135
|
inBuiltCss={defaultStyles}
|
|
136
|
+
labelPosition={labelPosition}
|
|
110
137
|
defaultOptionTextStyle={'toggle-switch-option-text'}
|
|
111
138
|
{...props}
|
|
112
139
|
>
|
|
113
140
|
{checked ? trueLabel : falseLabel}
|
|
114
|
-
</OptionText>
|
|
141
|
+
</OptionText>}
|
|
115
142
|
</CheckBoxWrapper>
|
|
116
143
|
);
|
|
117
144
|
};
|
|
@@ -142,9 +169,13 @@ ToggleSwitch.propTypes = {
|
|
|
142
169
|
* */
|
|
143
170
|
falseLabel: PropTypes.string,
|
|
144
171
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
172
|
+
* id of the Toggle switch
|
|
173
|
+
*/
|
|
147
174
|
id: PropTypes.string,
|
|
175
|
+
/**
|
|
176
|
+
* label position i.e:- left or right
|
|
177
|
+
*/
|
|
178
|
+
labelPosition: PropTypes.string
|
|
148
179
|
};
|
|
149
180
|
|
|
150
181
|
ToggleSwitch.defaultProps = {
|
|
@@ -153,5 +184,6 @@ ToggleSwitch.defaultProps = {
|
|
|
153
184
|
falseLabel: 'No',
|
|
154
185
|
customSwitchStyle: {},
|
|
155
186
|
customToggleBoxStyle: {},
|
|
156
|
-
id: ''
|
|
187
|
+
id: '',
|
|
188
|
+
labelPosition: 'right',
|
|
157
189
|
};
|
|
@@ -101,6 +101,8 @@ export const Navbar = ({
|
|
|
101
101
|
listElementStyle,
|
|
102
102
|
customSelectCardColor,
|
|
103
103
|
user,
|
|
104
|
+
firstBottomContent,
|
|
105
|
+
secondBottomContent,
|
|
104
106
|
...props
|
|
105
107
|
}) => {
|
|
106
108
|
const activeTheme = useTheme() || defaultThemeColor;
|
|
@@ -287,12 +289,13 @@ export const Navbar = ({
|
|
|
287
289
|
>
|
|
288
290
|
<ListElementFooter
|
|
289
291
|
listElementStyle={listElementStyle}
|
|
290
|
-
onClick={() => { }}
|
|
291
292
|
>
|
|
292
|
-
|
|
293
|
+
{firstBottomContent}
|
|
294
|
+
|
|
293
295
|
</ListElementFooter>
|
|
294
296
|
<ListElementFooter onClick={() => { }}>
|
|
295
|
-
|
|
297
|
+
|
|
298
|
+
{secondBottomContent}
|
|
296
299
|
</ListElementFooter>
|
|
297
300
|
</div>
|
|
298
301
|
}
|
|
@@ -132,6 +132,7 @@ const defaultStyles = {
|
|
|
132
132
|
'align-items': 'center',
|
|
133
133
|
'line-height': '.5rem',
|
|
134
134
|
'background-color': `${defaultThemeColor['bgColor']}`,
|
|
135
|
+
position: 'relative'
|
|
135
136
|
},
|
|
136
137
|
/**
|
|
137
138
|
* Default Style of the input wrapper
|
|
@@ -145,6 +146,9 @@ const defaultStyles = {
|
|
|
145
146
|
'font-size': '14px',
|
|
146
147
|
'flex-grow': '1',
|
|
147
148
|
'flex-shrink': '0',
|
|
149
|
+
'white-space': 'nowrap',
|
|
150
|
+
'overflow': 'hidden',
|
|
151
|
+
'text-overflow': 'ellipsis',
|
|
148
152
|
},
|
|
149
153
|
'textarea-wrapper': {
|
|
150
154
|
border: '0',
|
|
@@ -344,6 +348,7 @@ const defaultStyles = {
|
|
|
344
348
|
*/
|
|
345
349
|
'checkBox-outer': {
|
|
346
350
|
border: `2px solid ${defaultThemeColor.border}`,
|
|
351
|
+
minWidth: '20px',
|
|
347
352
|
width: '20px',
|
|
348
353
|
height: '20px',
|
|
349
354
|
'border-radius': '3px',
|
|
@@ -353,6 +358,7 @@ const defaultStyles = {
|
|
|
353
358
|
'checkBox-inner': {
|
|
354
359
|
'background-repeat': 'no-repeat',
|
|
355
360
|
'background-position': 'center',
|
|
361
|
+
minWidth: '20px',
|
|
356
362
|
width: '20px',
|
|
357
363
|
height: '20px',
|
|
358
364
|
color: `${defaultThemeColor.bgColor}`,
|
|
@@ -389,7 +395,6 @@ const defaultStyles = {
|
|
|
389
395
|
// 'background-color': `${defaultThemeColor.bgColor}`,
|
|
390
396
|
color: `${defaultThemeColor.neutral['neutral-1']}`,
|
|
391
397
|
'font-size': '16px',
|
|
392
|
-
'margin-right': '30px',
|
|
393
398
|
},
|
|
394
399
|
/**
|
|
395
400
|
* Default Style of the dropZone component
|