groundfloor-react-ui 1.0.18 → 1.0.19
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/Button/PrimaryButton.js +15 -8
- package/components/Button/SecondaryButton.js +11 -9
- package/components/Inputs/CheckBoxInput.js +34 -18
- package/components/Inputs/DateSelect.js +22 -17
- package/components/Inputs/DropdownSelect.js +31 -20
- package/components/Inputs/NumericInput.js +66 -63
- package/components/Inputs/PasswordInput.js +36 -27
- package/components/Inputs/TextInput.js +43 -28
- package/components/Inputs/TimeInput.js +95 -94
- package/components/constants/defaultStyle.js +0 -1
- package/dist/index.es.js +235 -228
- package/dist/index.js +213 -206
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
|
-
import { Loader } from '../Loaders';
|
|
6
5
|
import getDefaultStyles, { hexToRGB } from '../constants/utils';
|
|
6
|
+
import { Loader } from '../Loaders';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Primary UI component for user interaction
|
|
@@ -26,23 +26,22 @@ const sizes = {
|
|
|
26
26
|
|
|
27
27
|
const buttonDisabledBg = ({ theme, variant }) =>
|
|
28
28
|
hexToRGB(theme.variant[variant], 0.6);
|
|
29
|
-
const fontColor = defaultThemeColor.bgColor;
|
|
30
29
|
|
|
31
30
|
const StyledButton = styled.button`
|
|
32
31
|
background: ${({ theme, variant }) => theme.variant[variant]};
|
|
33
|
-
color: ${
|
|
32
|
+
color: ${({ theme }) => theme.bgColor};
|
|
34
33
|
padding: ${({ size }) => sizes[size].padding};
|
|
35
34
|
border: 1px solid ${({ theme, variant }) => theme.variant[variant]};
|
|
36
35
|
border-radius: 5px;
|
|
37
36
|
font-size: ${({ size }) => sizes[size].fontSize};
|
|
38
37
|
display: flex;
|
|
39
|
-
outline: none;
|
|
40
38
|
align-items: center;
|
|
41
39
|
width: ${({ block }) => (block ? '100%' : 'auto')};
|
|
42
40
|
cursor: pointer;
|
|
43
41
|
line-height: 18px;
|
|
42
|
+
outline: none;
|
|
44
43
|
&:disabled {
|
|
45
|
-
color: ${
|
|
44
|
+
color: ${({ theme }) => theme.bgColor};
|
|
46
45
|
background: ${buttonDisabledBg};
|
|
47
46
|
border: 1px solid ${buttonDisabledBg};
|
|
48
47
|
cursor: not-allowed;
|
|
@@ -57,6 +56,7 @@ const StyledButton = styled.button`
|
|
|
57
56
|
${({ btnStyle }) => btnStyle}
|
|
58
57
|
`;
|
|
59
58
|
|
|
59
|
+
|
|
60
60
|
export const PrimaryButton = ({
|
|
61
61
|
btnStyle,
|
|
62
62
|
block,
|
|
@@ -66,8 +66,11 @@ export const PrimaryButton = ({
|
|
|
66
66
|
disabled,
|
|
67
67
|
isLoading,
|
|
68
68
|
type,
|
|
69
|
+
theme,
|
|
69
70
|
...props
|
|
70
71
|
}) => {
|
|
72
|
+
const activeTheme = useTheme() || defaultThemeColor
|
|
73
|
+
|
|
71
74
|
return (
|
|
72
75
|
<StyledButton
|
|
73
76
|
block={block}
|
|
@@ -76,6 +79,7 @@ export const PrimaryButton = ({
|
|
|
76
79
|
type={type}
|
|
77
80
|
style={style}
|
|
78
81
|
size={size}
|
|
82
|
+
theme={theme}
|
|
79
83
|
disabled={disabled}
|
|
80
84
|
btnStyle={btnStyle}
|
|
81
85
|
{...props}
|
|
@@ -89,7 +93,10 @@ export const PrimaryButton = ({
|
|
|
89
93
|
alignItems: 'center',
|
|
90
94
|
}}
|
|
91
95
|
>
|
|
92
|
-
<Loader
|
|
96
|
+
<Loader
|
|
97
|
+
customStyles={{ 'background-color': activeTheme.bgColor }}
|
|
98
|
+
size={16}
|
|
99
|
+
/>
|
|
93
100
|
</div>
|
|
94
101
|
)}
|
|
95
102
|
{props.children}
|
|
@@ -131,7 +138,7 @@ PrimaryButton.propTypes = {
|
|
|
131
138
|
*/
|
|
132
139
|
type: PropTypes.string,
|
|
133
140
|
/**
|
|
134
|
-
*
|
|
141
|
+
* custom style of button
|
|
135
142
|
*/
|
|
136
143
|
btnStyle: PropTypes.object,
|
|
137
144
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import styled, { useTheme } from 'styled-components';
|
|
4
4
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
5
5
|
import getDefaultStyles from '../constants/utils';
|
|
@@ -24,8 +24,6 @@ const sizes = {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const buttonDisabledBg = '#BBC4CF';
|
|
28
|
-
const fontColor = defaultThemeColor.primary['primary-1'];
|
|
29
27
|
|
|
30
28
|
const StyledButton = styled.button`
|
|
31
29
|
color: ${({ theme, variant }) => theme.variant[variant]};
|
|
@@ -35,14 +33,14 @@ const StyledButton = styled.button`
|
|
|
35
33
|
font-size: ${({ size }) => sizes[size].fontSize};
|
|
36
34
|
border-radius: 5px;
|
|
37
35
|
display: flex;
|
|
38
|
-
outline: none;
|
|
39
36
|
align-items: center;
|
|
37
|
+
outline: none;
|
|
40
38
|
width: ${({ block }) => (block ? '100%' : 'auto')};
|
|
41
39
|
cursor: pointer;
|
|
42
40
|
line-height: 18px;
|
|
43
41
|
&:disabled {
|
|
44
42
|
color: #929eac;
|
|
45
|
-
border: 1px solid ${
|
|
43
|
+
border: 1px solid ${({ theme }) => theme.neutral['neutral-3']};
|
|
46
44
|
cursor: not-allowed;
|
|
47
45
|
}
|
|
48
46
|
|
|
@@ -63,10 +61,10 @@ export const SecondaryButton = ({
|
|
|
63
61
|
variant,
|
|
64
62
|
disabled,
|
|
65
63
|
type,
|
|
64
|
+
theme,
|
|
66
65
|
...props
|
|
67
66
|
}) => {
|
|
68
|
-
const
|
|
69
|
-
|
|
67
|
+
const activeTheme = useTheme() || defaultThemeColor
|
|
70
68
|
return (
|
|
71
69
|
<StyledButton
|
|
72
70
|
block={block}
|
|
@@ -78,6 +76,7 @@ export const SecondaryButton = ({
|
|
|
78
76
|
type={type}
|
|
79
77
|
btnStyle={btnStyle}
|
|
80
78
|
isLoading={isLoading}
|
|
79
|
+
theme={theme}
|
|
81
80
|
{...props}
|
|
82
81
|
>
|
|
83
82
|
{isLoading && (
|
|
@@ -89,8 +88,11 @@ export const SecondaryButton = ({
|
|
|
89
88
|
alignItems: 'center',
|
|
90
89
|
}}
|
|
91
90
|
>
|
|
92
|
-
<Loader
|
|
93
|
-
|
|
91
|
+
<Loader
|
|
92
|
+
theme={theme}
|
|
93
|
+
customStyles={{ 'background-color': activeTheme.variant[variant] }}
|
|
94
|
+
size={16}
|
|
95
|
+
/> </div>
|
|
94
96
|
)}
|
|
95
97
|
{props.children}{' '}
|
|
96
98
|
</StyledButton>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import styled, { useTheme } from 'styled-components';
|
|
5
4
|
import defaultStyles from '../constants/defaultStyle';
|
|
5
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
6
|
import getDefaultStyles from '../constants/utils';
|
|
7
7
|
import { Label } from '../Label';
|
|
8
8
|
// import tick from '../../assets/icons/checkmark.svg';
|
|
@@ -12,8 +12,8 @@ const CheckBoxOuter = styled.div`
|
|
|
12
12
|
box-sizing: initial;
|
|
13
13
|
|
|
14
14
|
//Set the styles from the default styles object
|
|
15
|
-
${({
|
|
16
|
-
return getDefaultStyles(
|
|
15
|
+
${({ inBuiltCss, defaultCheckBoxOuterStyle }) => {
|
|
16
|
+
return getDefaultStyles(inBuiltCss, defaultCheckBoxOuterStyle);
|
|
17
17
|
}}
|
|
18
18
|
|
|
19
19
|
border: 2px solid ${({ checkedCheckBoxColor, defaultBorderColor, checked }) =>
|
|
@@ -27,13 +27,13 @@ const CheckBoxInner = styled.div`
|
|
|
27
27
|
box-sizing: initial;
|
|
28
28
|
|
|
29
29
|
//Set the styles from the default styles object
|
|
30
|
-
${({
|
|
31
|
-
return getDefaultStyles(
|
|
30
|
+
${({ inBuiltCss, defaultCheckBoxInnerStyle }) => {
|
|
31
|
+
return getDefaultStyles(inBuiltCss, defaultCheckBoxInnerStyle);
|
|
32
32
|
}}
|
|
33
33
|
|
|
34
34
|
// background-image: url(${({ signCheck }) => signCheck});
|
|
35
|
-
background-color: ${({ checked, checkedCheckBoxColor }) =>
|
|
36
|
-
checked ? checkedCheckBoxColor :
|
|
35
|
+
background-color: ${({ checked, checkedCheckBoxColor, theme }) =>
|
|
36
|
+
checked ? checkedCheckBoxColor : theme.bgColor};
|
|
37
37
|
border: 2px solid
|
|
38
38
|
${({ checkedCheckBoxColor, defaultBorderColor, checked }) =>
|
|
39
39
|
checked ? checkedCheckBoxColor : defaultBorderColor};
|
|
@@ -50,8 +50,8 @@ CheckBoxInner.defaultProps = {
|
|
|
50
50
|
|
|
51
51
|
const OptionText = styled.span`
|
|
52
52
|
//Set the styles from the default styles object
|
|
53
|
-
${({
|
|
54
|
-
return getDefaultStyles(
|
|
53
|
+
${({ inBuiltCss, type }) => {
|
|
54
|
+
return getDefaultStyles(inBuiltCss, type);
|
|
55
55
|
}}
|
|
56
56
|
|
|
57
57
|
color: ${({ checked, defaultTextColor, checkedTextColor }) =>
|
|
@@ -70,6 +70,9 @@ const WrapperDiv = styled.label`
|
|
|
70
70
|
align-items: center;
|
|
71
71
|
display: flex;
|
|
72
72
|
gap: 10px;
|
|
73
|
+
|
|
74
|
+
// custom styles
|
|
75
|
+
${({ wrapperStyles }) => wrapperStyles}
|
|
73
76
|
`;
|
|
74
77
|
|
|
75
78
|
const ParentDiv = styled.div`
|
|
@@ -90,11 +93,16 @@ export const CheckBoxInput = ({
|
|
|
90
93
|
label,
|
|
91
94
|
options,
|
|
92
95
|
setOptions,
|
|
96
|
+
wrapperStyles,
|
|
93
97
|
inline,
|
|
94
98
|
wrapperStyle,
|
|
95
99
|
isRequired,
|
|
96
100
|
...props
|
|
97
101
|
}) => {
|
|
102
|
+
|
|
103
|
+
const activeTheme = useTheme() || defaultThemeColor
|
|
104
|
+
|
|
105
|
+
|
|
98
106
|
useEffect(() => {
|
|
99
107
|
filterCheckedOptions(options);
|
|
100
108
|
}, []);
|
|
@@ -125,7 +133,7 @@ export const CheckBoxInput = ({
|
|
|
125
133
|
|
|
126
134
|
<div style={{ display: 'flex' }}>
|
|
127
135
|
<Label
|
|
128
|
-
themeColor={defaultThemeColor}
|
|
136
|
+
// themeColor={defaultThemeColor}
|
|
129
137
|
customStyles={labelStyle}
|
|
130
138
|
type={'check-label'}
|
|
131
139
|
text={label}
|
|
@@ -136,7 +144,7 @@ export const CheckBoxInput = ({
|
|
|
136
144
|
<div
|
|
137
145
|
style={{
|
|
138
146
|
marginLeft: '4px',
|
|
139
|
-
color: `${
|
|
147
|
+
color: `${activeTheme.variant['error']}`,
|
|
140
148
|
}}
|
|
141
149
|
>
|
|
142
150
|
*
|
|
@@ -156,11 +164,13 @@ export const CheckBoxInput = ({
|
|
|
156
164
|
onClick={() => {
|
|
157
165
|
checkBox(item, i);
|
|
158
166
|
}}
|
|
167
|
+
wrapperStyles={wrapperStyles}
|
|
159
168
|
{...props}
|
|
160
169
|
>
|
|
161
170
|
{item.checked ? (
|
|
162
171
|
<CheckBoxInner
|
|
163
|
-
theme={
|
|
172
|
+
theme={activeTheme}
|
|
173
|
+
inBuiltCss={defaultStyles}
|
|
164
174
|
defaultCheckBoxInnerStyle={'checkBox-inner'}
|
|
165
175
|
checkBoxInnerStyle={{
|
|
166
176
|
...checkBoxInnerStyle,
|
|
@@ -176,7 +186,7 @@ export const CheckBoxInput = ({
|
|
|
176
186
|
</CheckBoxInner>
|
|
177
187
|
) : (
|
|
178
188
|
<CheckBoxOuter
|
|
179
|
-
|
|
189
|
+
inBuiltCss={defaultStyles}
|
|
180
190
|
defaultCheckBoxOuterStyle={'checkBox-outer'}
|
|
181
191
|
checkBoxOuterStyle={{
|
|
182
192
|
...checkBoxOuterStyle,
|
|
@@ -269,6 +279,10 @@ CheckBoxInput.propTypes = {
|
|
|
269
279
|
* mandatory field or not
|
|
270
280
|
*/
|
|
271
281
|
isRequired: PropTypes.bool,
|
|
282
|
+
/**
|
|
283
|
+
* Wrapper styles
|
|
284
|
+
*/
|
|
285
|
+
wrapperStyles: PropTypes.object,
|
|
272
286
|
};
|
|
273
287
|
|
|
274
288
|
CheckBoxInput.defaultProps = {
|
|
@@ -282,7 +296,9 @@ CheckBoxInput.defaultProps = {
|
|
|
282
296
|
checkBoxInnerStyle: {},
|
|
283
297
|
defaultTextColor: `${defaultThemeColor.neutral['neutral-2']}`,
|
|
284
298
|
checkedTextColor: `${defaultThemeColor.neutral['neutral-1']}`,
|
|
285
|
-
defaultBorderColor:
|
|
286
|
-
|
|
287
|
-
|
|
299
|
+
defaultBorderColor: `${defaultThemeColor.border
|
|
300
|
+
}`,
|
|
301
|
+
checkedCheckBoxColor: `${defaultThemeColor.primary['primary-1']} `,
|
|
302
|
+
isRequired: true,
|
|
303
|
+
wrapperStyles: {},
|
|
288
304
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import DatePicker from 'react-datepicker';
|
|
3
1
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
2
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import DatePicker from 'react-datepicker';
|
|
4
|
+
import styled, { useTheme } from 'styled-components';
|
|
5
5
|
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
6
6
|
|
|
7
7
|
import { Icon } from '../Icon';
|
|
@@ -26,7 +26,7 @@ const Wrapper = styled.div`
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.react-datepicker__input-container {
|
|
29
|
-
border: 1px solid ${
|
|
29
|
+
border: 1px solid ${({ theme }) => theme.border};
|
|
30
30
|
border-radius: 4px;
|
|
31
31
|
padding: 6px 12px;
|
|
32
32
|
display: flex;
|
|
@@ -232,8 +232,8 @@ const ListItem = styled('li')`
|
|
|
232
232
|
cursor: pointer;
|
|
233
233
|
`;
|
|
234
234
|
|
|
235
|
-
export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
236
|
-
const
|
|
235
|
+
export const DateSelect = ({ startDate, setStartDate, disabled, theme, ...props }) => {
|
|
236
|
+
const activeTheme = useTheme() || defaultThemeColor
|
|
237
237
|
|
|
238
238
|
const months = [
|
|
239
239
|
'January',
|
|
@@ -299,7 +299,7 @@ export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
|
299
299
|
}, []);
|
|
300
300
|
|
|
301
301
|
return (
|
|
302
|
-
<Wrapper disabled={disabled} {...props}>
|
|
302
|
+
<Wrapper disabled={disabled} theme={theme} {...props}>
|
|
303
303
|
<DatePicker
|
|
304
304
|
selected={startDate}
|
|
305
305
|
dateFormat='dd/MM/yyyy'
|
|
@@ -324,7 +324,7 @@ export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
|
324
324
|
onMouseEnter={() => setHover(true)}
|
|
325
325
|
onMouseLeave={() => setHover(false)}
|
|
326
326
|
style={{
|
|
327
|
-
color: `${hover ?
|
|
327
|
+
color: `${hover ? activeTheme.variant['primary-1'] : activeTheme.textColor
|
|
328
328
|
}`,
|
|
329
329
|
}}
|
|
330
330
|
>
|
|
@@ -333,14 +333,14 @@ export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
|
333
333
|
<IconDiv>
|
|
334
334
|
<Icon
|
|
335
335
|
icon='triangle-down'
|
|
336
|
-
color={hover ? '
|
|
336
|
+
color={hover ? activeTheme.variant['primary-1'] : activeTheme.textColor}
|
|
337
337
|
size={7}
|
|
338
338
|
/>
|
|
339
339
|
</IconDiv>
|
|
340
340
|
</DropDownHeader>
|
|
341
341
|
{isOpen && (
|
|
342
342
|
<DropDownListContainer>
|
|
343
|
-
<DropDownList onMouseEnter={() => setHover(true)}>
|
|
343
|
+
<DropDownList theme={theme} onMouseEnter={() => setHover(true)}>
|
|
344
344
|
{months.map((option, index) => (
|
|
345
345
|
<ListItem
|
|
346
346
|
selectedMonth={selectedMonth}
|
|
@@ -355,8 +355,8 @@ export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
|
355
355
|
<span
|
|
356
356
|
style={{
|
|
357
357
|
color: `${selectedMonth === option
|
|
358
|
-
?
|
|
359
|
-
:
|
|
358
|
+
? activeTheme.variant['primary-1']
|
|
359
|
+
: activeTheme.textColor
|
|
360
360
|
}`,
|
|
361
361
|
}}
|
|
362
362
|
>
|
|
@@ -381,8 +381,8 @@ export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
|
381
381
|
onMouseLeave={() => setHoverYear(false)}
|
|
382
382
|
style={{
|
|
383
383
|
color: `${hoverYear
|
|
384
|
-
?
|
|
385
|
-
:
|
|
384
|
+
? activeTheme.variant['primary-1']
|
|
385
|
+
: activeTheme.textColor
|
|
386
386
|
}`,
|
|
387
387
|
}}
|
|
388
388
|
>
|
|
@@ -391,7 +391,7 @@ export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
|
391
391
|
<IconDiv>
|
|
392
392
|
<Icon
|
|
393
393
|
icon='triangle-down'
|
|
394
|
-
color={hoverYear ? '
|
|
394
|
+
color={hoverYear ? activeTheme.variant['primary-1'] : activeTheme.textColor}
|
|
395
395
|
size={7}
|
|
396
396
|
/>
|
|
397
397
|
</IconDiv>
|
|
@@ -412,8 +412,8 @@ export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
|
412
412
|
<span
|
|
413
413
|
style={{
|
|
414
414
|
color: `${selectedYear === option
|
|
415
|
-
?
|
|
416
|
-
:
|
|
415
|
+
? activeTheme.variant['primary-1']
|
|
416
|
+
: activeTheme.textColor
|
|
417
417
|
}`,
|
|
418
418
|
}}
|
|
419
419
|
>
|
|
@@ -447,9 +447,14 @@ DateSelect.propTypes = {
|
|
|
447
447
|
* Disable property of DateSelect
|
|
448
448
|
*/
|
|
449
449
|
disabled: PropTypes.bool,
|
|
450
|
+
/**
|
|
451
|
+
* theme object
|
|
452
|
+
*/
|
|
453
|
+
theme: PropTypes.object,
|
|
450
454
|
};
|
|
451
455
|
|
|
452
456
|
DateSelect.defaultProps = {
|
|
457
|
+
theme: defaultThemeColor,
|
|
453
458
|
startDate: '',
|
|
454
459
|
setStartDate: () => { },
|
|
455
460
|
disabled: false,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import Select, { components } from 'react-select';
|
|
5
|
-
import
|
|
4
|
+
import AsyncSelect from 'react-select/async';
|
|
5
|
+
import styled, { useTheme } from 'styled-components';
|
|
6
6
|
import defaultStyles from '../constants/defaultStyle';
|
|
7
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
7
8
|
import getDefaultStyles from '../constants/utils';
|
|
8
|
-
import { Label } from '../Label';
|
|
9
9
|
import { Icon } from '../Icon';
|
|
10
|
-
import
|
|
10
|
+
import { Label } from '../Label';
|
|
11
11
|
|
|
12
12
|
const Wrapper = styled.div`
|
|
13
13
|
|
|
@@ -57,7 +57,7 @@ const Wrapper = styled.div`
|
|
|
57
57
|
|
|
58
58
|
.master-dropdown__option,
|
|
59
59
|
.new-select__option {
|
|
60
|
-
color:
|
|
60
|
+
color: ${({ theme }) => theme.textColor};
|
|
61
61
|
padding-top: 3px;
|
|
62
62
|
padding-bottom: 3px;
|
|
63
63
|
margin: 8px 0;
|
|
@@ -71,7 +71,7 @@ const Wrapper = styled.div`
|
|
|
71
71
|
.master-dropdown__option:hover,
|
|
72
72
|
.new-select__option--is-focused,
|
|
73
73
|
.new-select__option:hover {
|
|
74
|
-
background-color: ${
|
|
74
|
+
background-color: ${({ theme }) => theme.neutral['neutral-5']};
|
|
75
75
|
cursor: pointer;
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -115,12 +115,12 @@ const Wrapper = styled.div`
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
.text-main-alt {
|
|
118
|
-
color
|
|
118
|
+
color:${({ theme }) => theme.textColor} !important;
|
|
119
119
|
margin-right: 2px;
|
|
120
120
|
}
|
|
121
121
|
.text-more-alt{
|
|
122
122
|
font-size:12px;
|
|
123
|
-
color
|
|
123
|
+
color: ${({ theme }) => theme.neutral['neutral-2']};
|
|
124
124
|
|
|
125
125
|
}
|
|
126
126
|
.css-mohuvp-dummyInput-DummyInput{
|
|
@@ -143,16 +143,23 @@ const Wrapper = styled.div`
|
|
|
143
143
|
margin:0px;
|
|
144
144
|
padding:0px;
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
.new-select__control:hover,
|
|
147
|
+
.new-select__control--is-focused {
|
|
148
|
+
border: 1px solid ${({ theme }) => theme.primary['primary-1']};
|
|
149
|
+
}
|
|
147
150
|
`;
|
|
148
151
|
|
|
152
|
+
Wrapper.defaultProps = {
|
|
153
|
+
theme: defaultThemeColor,
|
|
154
|
+
};
|
|
155
|
+
|
|
149
156
|
const LabelWrapper = styled.div`
|
|
150
157
|
// Default style
|
|
151
158
|
display: flex;
|
|
152
159
|
|
|
153
160
|
//Set the styles from the default styles object
|
|
154
|
-
${({
|
|
155
|
-
return getDefaultStyles(
|
|
161
|
+
${({ inBuiltCss, labelWrapperStyle }) => {
|
|
162
|
+
return getDefaultStyles(inBuiltCss, labelWrapperStyle);
|
|
156
163
|
}}
|
|
157
164
|
// custom styles
|
|
158
165
|
${({ customLabelStyles }) => customLabelStyles}
|
|
@@ -185,6 +192,9 @@ export const DropdownSelect = ({
|
|
|
185
192
|
onInputChange,
|
|
186
193
|
...props
|
|
187
194
|
}) => {
|
|
195
|
+
|
|
196
|
+
const activeTheme = useTheme() || defaultThemeColor
|
|
197
|
+
|
|
188
198
|
const DropdownIndicator = (p) => {
|
|
189
199
|
return (
|
|
190
200
|
<components.DropdownIndicator {...p}>
|
|
@@ -218,7 +228,7 @@ export const DropdownSelect = ({
|
|
|
218
228
|
<div
|
|
219
229
|
style={{
|
|
220
230
|
...checkboxStyle,
|
|
221
|
-
backgroundColor: p?.data?.color ?? '
|
|
231
|
+
backgroundColor: p?.data?.color ?? activeTheme.primary['primary-1'],
|
|
222
232
|
}}
|
|
223
233
|
>
|
|
224
234
|
<Icon icon='check-icon' color='white' />
|
|
@@ -265,8 +275,10 @@ export const DropdownSelect = ({
|
|
|
265
275
|
control: (base, state) => ({
|
|
266
276
|
...base,
|
|
267
277
|
border: !isValid
|
|
268
|
-
? '1px solid ' +
|
|
269
|
-
: '1px solid ' +
|
|
278
|
+
? '1px solid ' + activeTheme.ui['error']
|
|
279
|
+
: '1px solid ' + activeTheme.border,
|
|
280
|
+
// border: state.isFocused ? '4px solid red' : '4px solid green',
|
|
281
|
+
|
|
270
282
|
height: `${height}px`,
|
|
271
283
|
minHeight: `${height}px`,
|
|
272
284
|
boxShadow: (state.isSelected || state.isFocused) && 'none',
|
|
@@ -319,7 +331,7 @@ export const DropdownSelect = ({
|
|
|
319
331
|
option: (provided, state) => ({
|
|
320
332
|
...provided,
|
|
321
333
|
backgroundColor:
|
|
322
|
-
state.isSelected || state.isFocused ? '
|
|
334
|
+
state.isSelected || state.isFocused ? activeTheme.neutral['neutral-5'] : activeTheme.bgColor,
|
|
323
335
|
padding: '10px',
|
|
324
336
|
cursor: 'pointer',
|
|
325
337
|
color: '#081348',
|
|
@@ -327,15 +339,14 @@ export const DropdownSelect = ({
|
|
|
327
339
|
...props.styles,
|
|
328
340
|
};
|
|
329
341
|
return (
|
|
330
|
-
<Wrapper style={customWrapperStyles} isValid={isValid} fontSize={fontSize}>
|
|
342
|
+
<Wrapper style={customWrapperStyles} isValid={isValid} fontSize={fontSize} theme={activeTheme}>
|
|
331
343
|
{label && (
|
|
332
344
|
<LabelWrapper
|
|
333
|
-
|
|
345
|
+
inBuiltCss={defaultStyles}
|
|
334
346
|
labelWrapperStyle={'selectComp-label-wrapper'}
|
|
335
347
|
style={customLabelStyles}
|
|
336
348
|
>
|
|
337
349
|
<Label
|
|
338
|
-
themeColor={defaultThemeColor}
|
|
339
350
|
customStyles={labelStyle}
|
|
340
351
|
type={'label-text'}
|
|
341
352
|
text={label}
|
|
@@ -345,7 +356,7 @@ export const DropdownSelect = ({
|
|
|
345
356
|
<div
|
|
346
357
|
style={{
|
|
347
358
|
marginLeft: '4px',
|
|
348
|
-
color: `${
|
|
359
|
+
color: `${activeTheme.ui['error']}`,
|
|
349
360
|
}}
|
|
350
361
|
>
|
|
351
362
|
*
|