groundfloor-react-ui 1.0.18 → 1.0.21

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.
Files changed (45) hide show
  1. package/components/Accordion/Accordion.js +83 -33
  2. package/components/Accordion/AccordionSB.js +50 -54
  3. package/components/Accordion/AccordionSBfooter.js +51 -55
  4. package/components/ArrowBar/ArrowBar.js +6 -23
  5. package/components/Avatar/Avatar.js +49 -45
  6. package/components/Avatar/AvatarSB.js +121 -92
  7. package/components/Avatar/AvatarSBfooter.js +113 -92
  8. package/components/Banner/Banner.js +40 -35
  9. package/components/Breadcrumb/Breadcrumb.js +178 -163
  10. package/components/Button/PrimaryButton.js +15 -8
  11. package/components/Button/SecondaryButton.js +11 -9
  12. package/components/Cards/Card.js +25 -30
  13. package/components/Cards/CardRef.js +41 -34
  14. package/components/Cards/DocumentCard.js +83 -89
  15. package/components/Divider/Divider.js +23 -30
  16. package/components/Drawer/Drawer.js +46 -55
  17. package/components/FilterChip/FilterChip.js +34 -32
  18. package/components/Form/HeaderComponent.js +57 -27
  19. package/components/GroupAvatars/GroupAvatars.js +12 -16
  20. package/components/GroupButtons/GroupButtonsPopup.js +3 -9
  21. package/components/Images/Image.js +16 -21
  22. package/components/Inputs/CheckBoxInput.js +71 -33
  23. package/components/Inputs/DateSelect.js +22 -17
  24. package/components/Inputs/DropdownSelect.js +86 -30
  25. package/components/Inputs/DropzoneInput.js +83 -68
  26. package/components/Inputs/NumericInput.js +66 -63
  27. package/components/Inputs/PasswordInput.js +36 -27
  28. package/components/Inputs/RadioInput.js +55 -29
  29. package/components/Inputs/Signature.js +88 -38
  30. package/components/Inputs/TextArea.js +24 -40
  31. package/components/Inputs/TextInput.js +43 -28
  32. package/components/Inputs/TimeInput.js +92 -107
  33. package/components/Inputs/ToggleSwitch.js +87 -59
  34. package/components/Modal/ModalComp.js +61 -37
  35. package/components/Pagination/Pagination.js +30 -54
  36. package/components/ProgressBar/ProgressBar.js +57 -40
  37. package/components/Rating/Rating.js +8 -14
  38. package/components/Sidebar/Navbar.js +196 -170
  39. package/components/Tables/Table.js +56 -34
  40. package/components/Tooltip/Tooltip.js +135 -141
  41. package/components/Typography/Typography.js +9 -10
  42. package/components/constants/defaultStyle.js +38 -41
  43. package/dist/index.es.js +675 -596
  44. package/dist/index.js +660 -581
  45. package/package.json +1 -1
@@ -1,34 +1,64 @@
1
- import React from 'react'
2
- import defaultThemeColor from '../constants/defaultThemeColor'
3
- import userIcon from "../../assets/icons/users.svg";
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import { useTheme } from 'styled-components';
4
+ import defaultThemeColor from '../constants/defaultThemeColor';
5
+ import { Icon } from '../Icon';
4
6
 
5
- export const HeaderComponent = ({ title, subtitle, wrapperstyle, imgLink, imgStyle }) => {
7
+ export const HeaderComponent = ({
8
+ title,
9
+ subtitle,
10
+ wrapperStyle,
11
+ imgLink,
12
+ imgStyle,
13
+ iconSize,
14
+ }) => {
15
+ const activeTheme = useTheme() || defaultThemeColor;
6
16
 
7
17
  const titleStyle = {
8
- 'fontSize': '26px',
9
- 'fontWeight': 'bold',
10
- 'color': `${defaultThemeColor.textColor}`,
11
- 'lineHeight': '36px',
12
- 'display': 'flex',
13
- 'gap': '14px',
14
- 'alignItems': 'flex-start',
15
- 'paddingLeft': '25px'
16
- }
18
+ fontSize: '26px',
19
+ fontWeight: 'bold',
20
+ color: `${activeTheme.textColor}`,
21
+ lineHeight: '36px',
22
+ display: 'flex',
23
+ gap: '14px',
24
+ alignItems: 'flex-start',
25
+ paddingLeft: '25px',
26
+ };
17
27
 
18
28
  const subtitleStyle = {
19
- 'fontSize': '13px',
20
- 'color': `${defaultThemeColor.neutral['neutral-2']}`,
21
- 'lineHeight': '24px',
22
- 'paddingLeft': '25px'
23
- }
29
+ fontSize: '13px',
30
+ color: `${activeTheme.neutral['neutral-2']}`,
31
+ lineHeight: '24px',
32
+ paddingLeft: '25px',
33
+ };
24
34
 
25
- return <div style={wrapperstyle}>
26
- <div style={titleStyle}>
27
- <img src={imgLink || userIcon} alt="userIcon" srcset="" style={imgStyle} />
28
- <h4>{title}</h4>
35
+ return (
36
+ <div style={wrapperStyle}>
37
+ <div style={titleStyle}>
38
+ {imgLink ? (
39
+ <img src={imgLink} alt='userIcon' srcset='' style={imgStyle} />
40
+ ) : (
41
+ <Icon
42
+ icon='user-icon'
43
+ size={iconSize}
44
+ color={activeTheme.primary['primary-1']}
45
+ />
46
+ )}{' '}
47
+ <h4>{title}</h4>
48
+ </div>
49
+ <div style={subtitleStyle}>
50
+ <p>{subtitle}</p>
51
+ </div>
29
52
  </div>
30
- <div style={subtitleStyle}>
31
- <p>{subtitle}</p>
32
- </div>
33
- </div>
34
- }
53
+ );
54
+ };
55
+
56
+ HeaderComponent.propTypes = {
57
+ /**
58
+ * How large should the default icon be?
59
+ */
60
+ size: PropTypes.number,
61
+ };
62
+ HeaderComponent.defaultProps = {
63
+ iconSize: 23,
64
+ };
@@ -1,8 +1,8 @@
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
+ import { Avatar } from '../Avatar';
4
5
  import defaultThemeColor from '../constants/defaultThemeColor';
5
- import { Avatar } from '../Avatar'
6
6
  /**
7
7
  * Primary UI component for user interaction
8
8
  */
@@ -26,7 +26,7 @@ const StyledQty = styled.p`
26
26
  `;
27
27
 
28
28
  export const GroupAvatars = ({ items, block, size, variantCircle, variantName, variantQty, flagName, user, colorCircle, colorBorderCircle, ...props }) => {
29
- const theme = useTheme() || defaultThemeColor;
29
+ const activeTheme = useTheme() || defaultThemeColor;
30
30
 
31
31
  return (
32
32
  <StyledContainer block={block} {...props}>
@@ -36,13 +36,13 @@ export const GroupAvatars = ({ items, block, size, variantCircle, variantName, v
36
36
  let customStylesImage = {}
37
37
 
38
38
  if (colorCircle) {
39
- customStylesCircle.backgroundColor = `${theme.variant[colorCircle]}`
39
+ customStylesCircle.backgroundColor = `${activeTheme.variant[colorCircle]}`
40
40
  } else {
41
- customStylesCircle.backgroundColor = `${theme.variant[variantCircle]}`
41
+ customStylesCircle.backgroundColor = `${activeTheme.variant[variantCircle]}`
42
42
  }
43
43
  if (i !== 0) {
44
- customStylesCircle.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${theme.variant[variantCircle]}`
45
- customStylesImage.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${theme.variant[variantCircle]}`
44
+ customStylesCircle.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${activeTheme.variant[variantCircle]}`
45
+ customStylesImage.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${activeTheme.variant[variantCircle]}`
46
46
  }
47
47
 
48
48
  return (
@@ -52,7 +52,7 @@ export const GroupAvatars = ({ items, block, size, variantCircle, variantName, v
52
52
  key={user.id}
53
53
  // variantCircle={variantCircle}
54
54
  customStylesContainer={{ width: 'auto' }}
55
- customStylesName={{ color: `${theme.variant[{ variantName }]}` }}
55
+ customStylesName={{ color: `${activeTheme.variant[{ variantName }]}` }}
56
56
  // block={false}
57
57
  size={size}
58
58
  toggleName={true}
@@ -68,7 +68,7 @@ export const GroupAvatars = ({ items, block, size, variantCircle, variantName, v
68
68
  // variantCircle={variantCircle}
69
69
  // variantName={variantName}
70
70
  customStylesContainer={{ width: 'auto' }}
71
- customStylesName={{ color: `${theme.variant[{ variantName }]}` }}
71
+ customStylesName={{ color: `${activeTheme.variant[{ variantName }]}` }}
72
72
  // block={false}
73
73
  size={size}
74
74
  toggleName={false}
@@ -82,7 +82,7 @@ export const GroupAvatars = ({ items, block, size, variantCircle, variantName, v
82
82
  ) : (null)
83
83
  )
84
84
  })}
85
- {(items.length - 4) > 0 ? (<StyledQty variantQty={variantQty}>+{items.length - 4}</StyledQty>) : null}
85
+ {(items.length - 4) > 0 ? (<StyledQty theme={activeTheme} variantQty={variantQty}>+{items.length - 4}</StyledQty>) : null}
86
86
  </StyledContainer>
87
87
  );
88
88
  };
@@ -122,12 +122,9 @@ GroupAvatars.propTypes = {
122
122
  variantQty: PropTypes.string,
123
123
  };
124
124
 
125
- StyledQty.defaultProps = {
126
- theme: defaultThemeColor,
127
- }
125
+
128
126
 
129
127
  GroupAvatars.defaultProps = {
130
- theme: defaultThemeColor,
131
128
  variantCircle: 'primary-1',
132
129
  variantName: 'primary-2',
133
130
  block: false,
@@ -139,5 +136,4 @@ GroupAvatars.defaultProps = {
139
136
  colorCircle: null,
140
137
  colorBorderCircle: "#FFFFFF",
141
138
  variantQty: 'primary-1'
142
- };
143
-
139
+ };
@@ -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 { ButtonPopup } from './ButtonPopup';
@@ -8,7 +8,6 @@ import { ButtonPopup } from './ButtonPopup';
8
8
  * Primary UI component for user interaction
9
9
  */
10
10
 
11
- const buttonDisabledBg = '#BBC4CF';
12
11
 
13
12
  const StyledContainer = styled.div`
14
13
  display: flex;
@@ -19,11 +18,7 @@ const StyledContainer = styled.div`
19
18
  border-radius: 3px;
20
19
  `;
21
20
 
22
- const StyledTooltip = styled.div`
23
- background-color: indianred;
24
- visibility: hidden;
25
- pointer-events: none;
26
- `
21
+
27
22
 
28
23
  const StyledItem = styled.div`
29
24
  display: flex;
@@ -165,5 +160,4 @@ GroupButtonsPopup.defaultProps = {
165
160
  variantBgDisable: 'bgColor',
166
161
  variantTPtext: null,
167
162
  variantTPbg: null,
168
- };
169
-
163
+ };
@@ -1,24 +1,24 @@
1
- import React, { useState, useEffect, useRef } from "react";
2
1
  import PropTypes from 'prop-types';
2
+ import React, { useEffect, useRef, useState } from "react";
3
3
  import styled from 'styled-components';
4
4
  import defaultStyles from '../constants/defaultStyle';
5
5
 
6
6
  const ImageLayout = styled.img`
7
7
  //Set the styles from the default styles object
8
- ${({ theme, type, size, customStyles }) => {
9
- if (theme) {
8
+ ${({ inBuiltCss, type, size, customStyles }) => {
9
+ if (inBuiltCss) {
10
10
  let tempObj = {};
11
- if (theme[type]) {
12
- for (const property in theme['common']) {
13
- tempObj[property] = theme['common'][property]
11
+ if (inBuiltCss[type]) {
12
+ for (const property in inBuiltCss['common']) {
13
+ tempObj[property] = inBuiltCss['common'][property]
14
14
  }
15
- for (const property in theme[type]) {
16
- tempObj[property] = theme[type][property]
17
- delete theme.common[property]
15
+ for (const property in inBuiltCss[type]) {
16
+ tempObj[property] = inBuiltCss[type][property]
17
+ delete inBuiltCss.common[property]
18
18
  }
19
- for (const property in theme[`${type}${size}`]) {
20
- tempObj[property] = theme[`${type}${size}`][property]
21
- delete theme.common[property]
19
+ for (const property in inBuiltCss[`${type}${size}`]) {
20
+ tempObj[property] = inBuiltCss[`${type}${size}`][property]
21
+ delete inBuiltCss.common[property]
22
22
  }
23
23
  }
24
24
  return { ...tempObj, ...customStyles };
@@ -26,7 +26,7 @@ const ImageLayout = styled.img`
26
26
  }}
27
27
  `;
28
28
 
29
- export const Image = ({ theme, customStyles, type, size, alt, src, handleImageStatus, ...props }) => {
29
+ export const Image = ({ customStyles, type, size, alt, src, handleImageStatus, ...props }) => {
30
30
 
31
31
  const [imageStatus, setImageStatus] = useState("loading");
32
32
 
@@ -58,7 +58,7 @@ export const Image = ({ theme, customStyles, type, size, alt, src, handleImageSt
58
58
  return (
59
59
  <ImageLayout
60
60
  {...props}
61
- theme={theme}
61
+ inBuiltCss={defaultStyles}
62
62
  customStyles={customStyles}
63
63
  type={type}
64
64
  alt={alt}
@@ -70,10 +70,7 @@ export const Image = ({ theme, customStyles, type, size, alt, src, handleImageSt
70
70
  }
71
71
 
72
72
  Image.propTypes = {
73
- /**
74
- * Theme props
75
- */
76
- theme: PropTypes.object,
73
+
77
74
  /**
78
75
  * Custom style object
79
76
  */
@@ -102,11 +99,9 @@ Image.propTypes = {
102
99
  }
103
100
 
104
101
  Image.defaultProps = {
105
- theme: defaultStyles,
106
102
  customStyles: null,
107
103
  type: 'image',
108
104
  alt: 'image alternative',
109
105
  src: null,
110
106
  handleImageStatus: null
111
- }
112
-
107
+ }
@@ -1,42 +1,65 @@
1
- import React, { useEffect, useState } from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
- import defaultThemeColor from '../constants/defaultThemeColor';
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
- import { Label } from '../Label';
8
- // import tick from '../../assets/icons/checkmark.svg';
9
7
  import { Icon } from '../Icon';
8
+ import { Label } from '../Label';
10
9
 
11
10
  const CheckBoxOuter = styled.div`
12
11
  box-sizing: initial;
13
12
 
14
13
  //Set the styles from the default styles object
15
- ${({ theme, defaultCheckBoxOuterStyle }) => {
16
- return getDefaultStyles(theme, defaultCheckBoxOuterStyle);
14
+ ${({ inBuiltCss, defaultCheckBoxOuterStyle }) => {
15
+ return getDefaultStyles(inBuiltCss, defaultCheckBoxOuterStyle);
17
16
  }}
18
17
 
19
- border: 2px solid ${({ checkedCheckBoxColor, defaultBorderColor, checked }) =>
20
- checked ? checkedCheckBoxColor : defaultBorderColor};
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
+ };
21
31
 
22
32
  // custom styles
23
33
  ${({ checkBoxOuterStyle }) => checkBoxOuterStyle}
24
34
  `;
25
35
 
36
+ CheckBoxOuter.defaultProps = {
37
+ theme: defaultThemeColor,
38
+ };
39
+
26
40
  const CheckBoxInner = styled.div`
27
41
  box-sizing: initial;
28
42
 
29
43
  //Set the styles from the default styles object
30
- ${({ theme, defaultCheckBoxInnerStyle }) => {
31
- return getDefaultStyles(theme, defaultCheckBoxInnerStyle);
44
+ ${({ inBuiltCss, defaultCheckBoxInnerStyle }) => {
45
+ return getDefaultStyles(inBuiltCss, defaultCheckBoxInnerStyle);
32
46
  }}
33
47
 
34
48
  // background-image: url(${({ signCheck }) => signCheck});
35
- background-color: ${({ checked, checkedCheckBoxColor }) =>
36
- checked ? checkedCheckBoxColor : defaultThemeColor.bgColor};
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
+ }};
37
55
  border: 2px solid
38
- ${({ checkedCheckBoxColor, defaultBorderColor, checked }) =>
39
- checked ? checkedCheckBoxColor : defaultBorderColor};
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
+ }};
40
63
  display: flex;
41
64
  justify-content: center;
42
65
  align-items: center;
@@ -44,24 +67,30 @@ const CheckBoxInner = styled.div`
44
67
  ${({ checkBoxInnerStyle }) => checkBoxInnerStyle}
45
68
  `;
46
69
  CheckBoxInner.defaultProps = {
47
- themeColor: defaultThemeColor,
48
- // signCheck: `${tick}`
70
+ theme: defaultThemeColor,
49
71
  };
50
72
 
51
73
  const OptionText = styled.span`
52
74
  //Set the styles from the default styles object
53
- ${({ theme, type }) => {
54
- return getDefaultStyles(theme, type);
75
+ ${({ inBuiltCss, type }) => {
76
+ return getDefaultStyles(inBuiltCss, type);
55
77
  }}
56
78
 
57
- color: ${({ checked, defaultTextColor, checkedTextColor }) =>
58
- checked ? checkedTextColor : defaultTextColor};
79
+ color: ${({ theme, checked, defaultTextColor, checkedTextColor }) => {
80
+ if (checked && checkedTextColor) return checkedTextColor;
81
+ else if (checked && !checkedTextColor) return theme.neutral['neutral-1'];
82
+ else if (!checked && defaultTextColor) return defaultTextColor;
83
+ else if (!checked && !defaultTextColor) return theme.neutral['neutral-2'];
84
+ }};
59
85
 
60
86
  margin-right: ${({ inline }) => (inline ? '30px' : '0px')};
61
87
 
62
88
  // custom styles
63
89
  ${({ optionTextStyle }) => optionTextStyle}
64
90
  `;
91
+ OptionText.defaultProps = {
92
+ theme: defaultThemeColor,
93
+ };
65
94
 
66
95
  const WrapperDiv = styled.label`
67
96
  width: fit-content;
@@ -70,6 +99,9 @@ const WrapperDiv = styled.label`
70
99
  align-items: center;
71
100
  display: flex;
72
101
  gap: 10px;
102
+
103
+ // custom styles
104
+ ${({ wrapperStyles }) => wrapperStyles}
73
105
  `;
74
106
 
75
107
  const ParentDiv = styled.div`
@@ -90,11 +122,14 @@ export const CheckBoxInput = ({
90
122
  label,
91
123
  options,
92
124
  setOptions,
125
+ wrapperStyles,
93
126
  inline,
94
127
  wrapperStyle,
95
128
  isRequired,
96
129
  ...props
97
130
  }) => {
131
+ const activeTheme = useTheme() || defaultThemeColor;
132
+
98
133
  useEffect(() => {
99
134
  filterCheckedOptions(options);
100
135
  }, []);
@@ -122,10 +157,8 @@ export const CheckBoxInput = ({
122
157
 
123
158
  return (
124
159
  <div style={returnedTarget} {...props}>
125
-
126
160
  <div style={{ display: 'flex' }}>
127
161
  <Label
128
- themeColor={defaultThemeColor}
129
162
  customStyles={labelStyle}
130
163
  type={'check-label'}
131
164
  text={label}
@@ -136,7 +169,7 @@ export const CheckBoxInput = ({
136
169
  <div
137
170
  style={{
138
171
  marginLeft: '4px',
139
- color: `${defaultThemeColor.variant['error']}`,
172
+ color: `${activeTheme.variant['error']}`,
140
173
  }}
141
174
  >
142
175
  *
@@ -156,11 +189,13 @@ export const CheckBoxInput = ({
156
189
  onClick={() => {
157
190
  checkBox(item, i);
158
191
  }}
192
+ wrapperStyles={wrapperStyles}
159
193
  {...props}
160
194
  >
161
195
  {item.checked ? (
162
196
  <CheckBoxInner
163
- theme={defaultStyles}
197
+ theme={activeTheme}
198
+ inBuiltCss={defaultStyles}
164
199
  defaultCheckBoxInnerStyle={'checkBox-inner'}
165
200
  checkBoxInnerStyle={{
166
201
  ...checkBoxInnerStyle,
@@ -176,7 +211,7 @@ export const CheckBoxInput = ({
176
211
  </CheckBoxInner>
177
212
  ) : (
178
213
  <CheckBoxOuter
179
- theme={defaultStyles}
214
+ inBuiltCss={defaultStyles}
180
215
  defaultCheckBoxOuterStyle={'checkBox-outer'}
181
216
  checkBoxOuterStyle={{
182
217
  ...checkBoxOuterStyle,
@@ -184,10 +219,12 @@ export const CheckBoxInput = ({
184
219
  borderColor: item?.disabledColor,
185
220
  }}
186
221
  defaultBorderColor={defaultBorderColor}
222
+ theme={activeTheme}
187
223
  {...props}
188
224
  />
189
225
  )}
190
226
  <OptionText
227
+ theme={activeTheme}
191
228
  inline={inline}
192
229
  optionTextStyle={{
193
230
  ...optionTextStyle,
@@ -266,9 +303,13 @@ CheckBoxInput.propTypes = {
266
303
  */
267
304
  getCheckedArr: PropTypes.func,
268
305
  /**
269
- * mandatory field or not
270
- */
306
+ * mandatory field or not
307
+ */
271
308
  isRequired: PropTypes.bool,
309
+ /**
310
+ * Wrapper styles
311
+ */
312
+ wrapperStyles: PropTypes.object,
272
313
  };
273
314
 
274
315
  CheckBoxInput.defaultProps = {
@@ -280,9 +321,6 @@ CheckBoxInput.defaultProps = {
280
321
  labelStyle: {},
281
322
  checkBoxOuterStyle: {},
282
323
  checkBoxInnerStyle: {},
283
- defaultTextColor: `${defaultThemeColor.neutral['neutral-2']}`,
284
- checkedTextColor: `${defaultThemeColor.neutral['neutral-1']}`,
285
- defaultBorderColor: '#D4D7E3',
286
- checkedCheckBoxColor: `${defaultThemeColor.primary['primary-1']}`,
287
- isRequired: true
324
+ isRequired: true,
325
+ wrapperStyles: {},
288
326
  };
@@ -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 styled from 'styled-components';
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 ${defaultThemeColor.border};
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 theme = defaultThemeColor;
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 ? theme.variant['primary-1'] : theme.textColor
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 ? 'blue' : 'black'}
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
- ? theme.variant['primary-1']
359
- : theme.textColor
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
- ? theme.variant['primary-1']
385
- : theme.textColor
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 ? 'blue' : 'black'}
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
- ? theme.variant['primary-1']
416
- : theme.textColor
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,