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,64 +1,71 @@
1
- import React, { forwardRef } from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
2
+ import React, { forwardRef } from 'react';
3
+ import styled, { useTheme } from 'styled-components';
4
4
  import defaultStyles from '../constants/defaultStyle';
5
+ import defaultThemeColor from '../constants/defaultThemeColor';
5
6
 
6
7
  const CardWrapper = styled.div`
7
- //Set the styles from the default styles object
8
- ${({ theme, type }) => {
9
- if (theme) {
8
+
9
+ color: ${({ activeTheme }) => activeTheme.textColor};
10
+ padding-top: 25px;
11
+ padding-bottom: 25px;
12
+ padding-left: 32px;
13
+ padding-right: 32px;
14
+ background-color: ${({ activeTheme }) => activeTheme.bgColor};
15
+ width: inherit;
16
+ border-radius: 5px;
17
+ box-shadow: 0px 5px 37px rgba(56, 66, 100, 0.0880136);
18
+ border-color: ${({ activeTheme }) => activeTheme.border};
19
+ transition: all .5s ease .95ms !important;
20
+
21
+ //Set the styles from the default styles object
22
+ ${({ inBuiltCss, type }) => {
23
+ if (inBuiltCss) {
10
24
  let tempObj = {};
11
- if (theme[type]) {
12
- for (const property in theme[type]) {
13
- tempObj[property] = theme[type][property]
14
- delete theme.common[property]
25
+ if (inBuiltCss[type]) {
26
+ for (const property in inBuiltCss[type]) {
27
+ tempObj[property] = inBuiltCss[type][property];
28
+ delete inBuiltCss.common[property];
15
29
  }
16
- for (const property in theme['common']) {
17
- tempObj[property] = theme['common'][property]
30
+ for (const property in inBuiltCss['common']) {
31
+ tempObj[property] = inBuiltCss['common'][property];
18
32
  }
19
33
  }
20
34
  return tempObj;
21
35
  }
22
36
  }}
23
-
24
- // custom styles
37
+
38
+ // custom styles
25
39
  ${({ customStyles }) => customStyles}
26
40
  `;
27
41
 
28
- CardWrapper.defaultProps = {
29
- theme: defaultStyles
30
- }
42
+ export const CardRef = forwardRef(({ type, header, content, ...props }, ref) => {
43
+ const activeTheme = useTheme() || defaultThemeColor;
31
44
 
32
- export const CardRef = forwardRef(({ type, theme, header, content, ...props }, ref) => {
33
45
  return (
34
- <CardWrapper theme={defaultStyles} type={'card'} {...props} ref={ref}>
46
+ <CardWrapper
47
+ inBuiltCss={defaultStyles}
48
+ activeTheme={activeTheme}
49
+ {...props}
50
+ ref={ref}
51
+ >
35
52
  {header}
36
53
  {content}
37
54
  </CardWrapper>
38
- )
39
- })
55
+ );
56
+ });
40
57
 
41
58
  CardRef.propTypes = {
42
- /**
43
- * theme Object
44
- */
45
- theme: PropTypes.object,
46
59
  /**
47
60
  * the type of the element
48
- */
61
+ */
49
62
  type: PropTypes.string,
50
63
  /**
51
- * header of the card
64
+ * header of the card
52
65
  */
53
66
  header: PropTypes.any,
54
67
  /**
55
68
  * the content of the card
56
- */
69
+ */
57
70
  content: PropTypes.any,
58
- }
59
-
60
- CardRef.defaultProps = {
61
- theme: defaultStyles,
62
- type: 'card',
63
- }
64
-
71
+ };
@@ -1,11 +1,11 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import styled, { useTheme, css } from 'styled-components';
2
+ import React from 'react';
3
+ import styled, { css, useTheme } from 'styled-components';
4
4
  import defaultThemeColor from '../constants/defaultThemeColor';
5
5
 
6
6
  /**
7
7
  * Primary UI component for user interaction
8
- */
8
+ */
9
9
 
10
10
  const sizes = {
11
11
  sm: {
@@ -18,7 +18,7 @@ const sizes = {
18
18
  footerMinHeight: '31px',
19
19
  footerPadding: '10.5px 16px',
20
20
  footerLineHeight: '16px',
21
- lineHeight: '12px'
21
+ lineHeight: '12px',
22
22
  },
23
23
  md: {
24
24
  cardWidth: '215px',
@@ -30,82 +30,91 @@ const sizes = {
30
30
  footerMinHeight: '54px',
31
31
  footerPadding: '18px 19px',
32
32
  footerLineHeight: '12px',
33
- lineHeight: '16px'
33
+ lineHeight: '16px',
34
34
  },
35
- }
35
+ };
36
36
 
37
37
  const StyledDocumentCard = styled.div`
38
- ${({ trimFileName }) => {
38
+ ${({ trimFileName }) => {
39
39
  if (trimFileName) {
40
- return (css`height: ${({ size }) => sizes[size].cardMinHeight};`)
40
+ return css`
41
+ height: ${({ size }) => sizes[size].cardMinHeight};
42
+ `;
41
43
  } else {
42
- return (css`min-height: ${({ size }) => sizes[size].cardMinHeight};`)
44
+ return css`
45
+ min-height: ${({ size }) => sizes[size].cardMinHeight};
46
+ `;
43
47
  }
44
48
  }}
45
- width: ${({ size }) => sizes[size].cardWidth};
46
- border-radius: ${({ size }) => sizes[size].borderRadius};
47
- border: ${({ size }) => sizes[size].border} solid ${({ theme, variantBorder }) => theme.variant[variantBorder]};
48
- box-sizing: border-box;
49
+ width: ${({ size }) => sizes[size].cardWidth};
50
+ border-radius: ${({ size }) => sizes[size].borderRadius};
51
+ border: ${({ size }) => sizes[size].border} solid
52
+ ${({ theme, variantBorder }) => theme.variant[variantBorder]};
53
+ box-sizing: border-box;
49
54
 
50
- &:hover {
51
- border: ${({ size }) => sizes[size].border} solid ${({ theme, variantBorderHover }) => theme.variant[variantBorderHover]};
52
- button {
53
- &:hover {
54
- opacity: 0.8;
55
- }
56
- }
55
+ &:hover {
56
+ border: ${({ size }) => sizes[size].border} solid
57
+ ${({ theme, variantBorderHover }) => theme.variant[variantBorderHover]};
58
+ button {
59
+ &:hover {
60
+ opacity: 0.8;
61
+ }
57
62
  }
58
- `
63
+ }
64
+ `;
59
65
 
60
66
  const StyledCardBody = styled.div`
61
- display: flex;
62
- justify-content: ${({ buttons }) => buttons !== '11' ? 'center' : 'space-between'};
63
- align-items: center;
64
- height: ${({ size }) => sizes[size].bodyHeight};
65
- margin: 0;
66
- padding: ${({ size }) => sizes[size].bodyPadding};
67
- border: none;
68
- border-top-left-radius: ${({ size }) => sizes[size].borderRadius};
69
- border-top-right-radius: ${({ size }) => sizes[size].borderRadius};
70
- background-color: ${({ theme, variantBgBody }) => theme.variant[variantBgBody]};
71
- background: linear-gradient(0deg, rgba(226, 230, 245, 0.5), rgba(226, 230, 245, 0.5)) ${({ bgUrl }) => bgUrl ? `, url('/images/documentCardBG.png')` : null};
72
- background-size: cover;
73
- box-sizing: border-box;
74
- `
67
+ display: flex;
68
+ justify-content: ${({ buttons }) =>
69
+ buttons !== '11' ? 'center' : 'space-between'};
70
+ align-items: center;
71
+ height: ${({ size }) => sizes[size].bodyHeight};
72
+ margin: 0;
73
+ padding: ${({ size }) => sizes[size].bodyPadding};
74
+ border: none;
75
+ border-top-left-radius: ${({ size }) => sizes[size].borderRadius};
76
+ border-top-right-radius: ${({ size }) => sizes[size].borderRadius};
77
+ background-color: ${({ theme, variantBgBody }) =>
78
+ theme.variant[variantBgBody]};
79
+ background: linear-gradient(
80
+ 0deg,
81
+ rgba(226, 230, 245, 0.5),
82
+ rgba(226, 230, 245, 0.5)
83
+ )
84
+ ${({ bgUrl }) => (bgUrl ? `, url('/images/documentCardBG.png')` : null)};
85
+ background-size: cover;
86
+ box-sizing: border-box;
87
+ `;
75
88
 
76
89
  const StyledCardFooter = styled.div`
77
- ${({ trimFileName }) => {
90
+ ${({ trimFileName }) => {
78
91
  if (trimFileName) {
79
- return (
80
- css`
81
- white-space: nowrap;
82
- overflow: hidden;
83
- text-overflow: ellipsis;
84
- height: ${({ size }) => sizes[size].footerMinHeight};
85
- `
86
- )
92
+ return css`
93
+ white-space: nowrap;
94
+ overflow: hidden;
95
+ text-overflow: ellipsis;
96
+ height: ${({ size }) => sizes[size].footerMinHeight};
97
+ `;
87
98
  } else {
88
- return (
89
- css`
90
- display: flex;
91
- align-items: center;
92
- min-height: ${({ size }) => sizes[size].footerMinHeight};
93
- overflow-wrap: anywhere;
94
- hyphens: auto;
95
- `
96
- )
99
+ return css`
100
+ display: flex;
101
+ align-items: center;
102
+ min-height: ${({ size }) => sizes[size].footerMinHeight};
103
+ overflow-wrap: anywhere;
104
+ hyphens: auto;
105
+ `;
97
106
  }
98
107
  }}
99
- font-size: ${({ size }) => sizes[size].footerFontSize};
100
- padding: ${({ size }) => sizes[size].footerPadding};
101
- color: ${({ theme, variant }) => theme.variant[variant]};
102
- background-color: ${({ theme, variantBgFooter }) => variantBgFooter ? theme.variant[variantBgFooter] : theme['bgColor']};
103
- box-sizing: border-box;
104
- line-height: ${({ size }) => sizes[size].lineHeight};
105
- border-bottom-left-radius: inherit;
106
- border-bottom-right-radius: inherit;
107
- `
108
-
108
+ font-size: ${({ size }) => sizes[size].footerFontSize};
109
+ padding: ${({ size }) => sizes[size].footerPadding};
110
+ color: ${({ theme, variant }) => theme.variant[variant]};
111
+ background-color: ${({ theme, variantBgFooter }) =>
112
+ variantBgFooter ? theme.variant[variantBgFooter] : theme['bgColor']};
113
+ box-sizing: border-box;
114
+ line-height: ${({ size }) => sizes[size].lineHeight};
115
+ border-bottom-left-radius: inherit;
116
+ border-bottom-right-radius: inherit;
117
+ `;
109
118
  export const DocumentCard = ({
110
119
  variant,
111
120
  variantBorder,
@@ -117,9 +126,9 @@ export const DocumentCard = ({
117
126
  size,
118
127
  trimFileName,
119
128
  bodyContent,
120
- ...props }) => {
121
-
122
- const theme = useTheme() || defaultThemeColor;
129
+ ...props
130
+ }) => {
131
+ const activeTheme = useTheme() || defaultThemeColor;
123
132
 
124
133
  return (
125
134
  <StyledDocumentCard
@@ -128,12 +137,14 @@ export const DocumentCard = ({
128
137
  variantBgBody={variantBgBody}
129
138
  size={size}
130
139
  trimFileName={trimFileName}
140
+ theme={activeTheme}
131
141
  {...props}
132
142
  >
133
- <StyledCardBody bgUrl={bgUrl} size={size} >
143
+ <StyledCardBody bgUrl={bgUrl} size={size} theme={activeTheme}>
134
144
  {bodyContent}
135
145
  </StyledCardBody>
136
146
  <StyledCardFooter
147
+ theme={activeTheme}
137
148
  title={fileName}
138
149
  variant={variant}
139
150
  variantBgFooter={variantBgFooter}
@@ -143,8 +154,8 @@ export const DocumentCard = ({
143
154
  {fileName}
144
155
  </StyledCardFooter>
145
156
  </StyledDocumentCard>
146
- )
147
- }
157
+ );
158
+ };
148
159
 
149
160
  DocumentCard.propTypes = {
150
161
  /**
@@ -183,30 +194,14 @@ DocumentCard.propTypes = {
183
194
  * If true if the fimeName is longer than the width is trimmed. If false the fileName is wrapped and the footer expands vertically
184
195
  */
185
196
  trimFileName: PropTypes.bool,
186
- /**
187
- * Theme object
188
- */
189
- theme: PropTypes.object,
197
+
190
198
  /**
191
199
  * Children component of the Card Body
192
200
  */
193
201
  bodyContent: PropTypes.element,
194
202
  };
195
203
 
196
- StyledDocumentCard.defaultProps = {
197
- theme: defaultThemeColor,
198
- }
199
-
200
- StyledCardBody.defaultProps = {
201
- theme: defaultThemeColor,
202
- }
203
-
204
- StyledCardFooter.defaultProps = {
205
- theme: defaultThemeColor,
206
- }
207
-
208
204
  DocumentCard.defaultProps = {
209
- theme: defaultThemeColor,
210
205
  variant: 'black',
211
206
  variantBorder: 'neutral-5',
212
207
  variantBorderHover: 'primary-1',
@@ -216,6 +211,5 @@ DocumentCard.defaultProps = {
216
211
  bgUrl: null,
217
212
  size: 'md',
218
213
  trimFileName: true,
219
- bodyContent: null
220
- };
221
-
214
+ bodyContent: null,
215
+ };
@@ -1,40 +1,40 @@
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
 
6
6
  /**
7
7
  * Primary UI component for user interaction
8
- */
8
+ */
9
9
 
10
10
  const StyledDivider = styled.div`
11
- display: ${({ vertical }) => vertical ? 'inline-block' : 'block'};
12
- background: ${({ theme, variant, borderColor }) => borderColor ? borderColor : theme.variant[variant]};
13
- content: '';
14
- height: ${({ vertical, thickness, height }) => vertical ? height : thickness};
15
- width: ${({ vertical, thickness }) => vertical ? thickness : null};
16
- `
17
-
11
+ display: ${({ vertical }) => (vertical ? 'inline-block' : 'block')};
12
+ background: ${({ theme, borderColor }) =>
13
+ borderColor ? borderColor : theme.neutral['neutral-5']};
14
+ content: '';
15
+ height: ${({ vertical, thickness, height }) =>
16
+ vertical ? height : thickness};
17
+ width: ${({ vertical, thickness }) => (vertical ? thickness : null)};
18
+ `;
18
19
  export const Divider = ({ vertical, borderColor, thickness, height, ...props }) => {
19
- const theme = useTheme() || defaultThemeColor;
20
+ const activeTheme = useTheme() || defaultThemeColor;
20
21
  return (
21
- <StyledDivider borderColor={borderColor} thickness={thickness} vertical={vertical} height={height} {...props} />
22
- )
23
- }
22
+ <StyledDivider
23
+ theme={activeTheme}
24
+ borderColor={borderColor}
25
+ thickness={thickness}
26
+ vertical={vertical}
27
+ height={height}
28
+ {...props}
29
+ />
30
+ );
31
+ };
24
32
 
25
33
  Divider.propTypes = {
26
- /**
27
- * Optional: Color of Divider
28
- */
29
- variant: PropTypes.string,
30
34
  /**
31
35
  * Optional: How thick should be the divider in px
32
36
  */
33
37
  thickness: PropTypes.string,
34
- /**
35
- * Theme object
36
- */
37
- theme: PropTypes.object,
38
38
  /**
39
39
  * Optional custom border color
40
40
  */
@@ -49,15 +49,8 @@ Divider.propTypes = {
49
49
  height: PropTypes.string,
50
50
  };
51
51
 
52
- StyledDivider.defaultProps = {
53
- theme: defaultThemeColor,
54
- }
55
-
56
52
  Divider.defaultProps = {
57
- theme: defaultThemeColor,
58
- variant: 'neutral-5',
59
53
  thickness: '2px',
60
54
  vertical: false,
61
- height: '10px'
62
- };
63
-
55
+ height: '10px',
56
+ };
@@ -1,6 +1,6 @@
1
- import React from "react";
2
1
  import PropTypes from 'prop-types';
3
- import styled, { css } from 'styled-components';
2
+ import React from "react";
3
+ import styled from 'styled-components';
4
4
  import defaultStyles from '../constants/defaultStyle';
5
5
 
6
6
  /**
@@ -26,68 +26,59 @@ import defaultStyles from '../constants/defaultStyle';
26
26
 
27
27
  const StyledContainer = styled.div`
28
28
  //Set the styles from the default styles object
29
- ${({ theme, type, drawerOpen, customStyles }) => {
30
- if (theme) {
31
- let tempObj = {};
32
- if (theme[type]) {
33
- for (const property in theme['common']) {
34
- tempObj[property] = theme['common'][property]
35
- }
36
- for (const property in theme[type]) {
37
- delete theme.common[property]
38
- tempObj[property] = theme[type][property]
39
- }
40
- if (drawerOpen) {
41
- tempObj = { ...tempObj, ...theme['drawer-open'] }
42
- } else {
43
- tempObj = { ...tempObj, ...theme['drawer-close'] }
44
- }
45
- }
46
- return { ...tempObj, ...customStyles };
29
+ ${({ inBuiltCss, type, drawerOpen, customStyles }) => {
30
+ if (inBuiltCss) {
31
+ let tempObj = {};
32
+ if (inBuiltCss[type]) {
33
+ for (const property in inBuiltCss['common']) {
34
+ tempObj[property] = inBuiltCss['common'][property]
35
+ }
36
+ for (const property in inBuiltCss[type]) {
37
+ delete inBuiltCss.common[property]
38
+ tempObj[property] = inBuiltCss[type][property]
39
+ }
40
+ if (drawerOpen) {
41
+ tempObj = { ...tempObj, ...inBuiltCss['drawer-open'] }
42
+ } else {
43
+ tempObj = { ...tempObj, ...inBuiltCss['drawer-close'] }
47
44
  }
48
- }}
45
+ }
46
+ return { ...tempObj, ...customStyles };
47
+ }
48
+ }}
49
49
  `;
50
50
 
51
51
  export const Drawer = ({
52
- theme,
53
- customStyles,
54
- drawerOpen,
55
- children,
56
- ...props
52
+ customStyles,
53
+ drawerOpen,
54
+ children,
55
+ ...props
57
56
  }) => {
58
57
 
59
58
 
60
- // return ReactDom.createPortal(
61
- return (
62
- <StyledContainer
63
- theme={theme}
64
- customStyles={customStyles}
65
- type={'drawer'}
66
- drawerOpen={drawerOpen}
67
- {...props}
68
- >
69
- {children}
70
- </StyledContainer>
59
+ // return ReactDom.createPortal(
60
+ return (
61
+ <StyledContainer
62
+ inBuiltCss={defaultStyles}
63
+ customStyles={customStyles}
64
+ type={'drawer'}
65
+ drawerOpen={drawerOpen}
66
+ {...props}
67
+ >
68
+ {children}
69
+ </StyledContainer>
71
70
 
72
- );
71
+ );
73
72
  };
74
73
 
75
74
  Drawer.propTypes = {
76
- /**
77
- * Theme object
78
- */
79
- theme: PropTypes.object,
80
- /**
81
- * Custom style object
82
- */
83
- customStyles: PropTypes.object,
84
- /**
85
- * Boolean value to to open and close the drawer
86
- */
87
- drawerOpen: PropTypes.bool,
88
- };
89
-
90
- Drawer.defaultProps = {
91
- theme: defaultStyles,
92
- };
93
75
 
76
+ /**
77
+ * Custom style object
78
+ */
79
+ customStyles: PropTypes.object,
80
+ /**
81
+ * Boolean value to to open and close the drawer
82
+ */
83
+ drawerOpen: PropTypes.bool,
84
+ };
@@ -1,50 +1,53 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
2
+ import React from 'react';
3
3
  import styled, { css, useTheme } from 'styled-components';
4
+ import { hexToRGB } from '../constants';
4
5
  import defaultThemeColor from '../constants/defaultThemeColor';
5
6
 
6
- const border = `#F6F6F9;`;
7
+ // const border = `#F6F6F9;`;
7
8
 
8
9
  const selectedCss = css`
9
- color: ${({ theme }) => theme.variant['primary-1']};
10
- border: 1px solid ${({ theme }) => theme.variant['primary-1']};
11
- background: #F3F5FF;
10
+ color: ${({ theme }) => theme.variant['primary-1']};
11
+ border: 1px solid ${({ theme }) => theme.variant['primary-1']};
12
+ background: ${({ theme }) => hexToRGB(theme.primary['primary-1'], 0.04)};
12
13
  `;
13
14
 
14
15
  const StyledButton = styled.button`
15
- font-size: 14px;
16
- color: ${({ theme }) => theme.variant['primary-2']};
17
- background: ${border};
18
- border: 1px solid ${border};
19
- padding: 4px 24px;
20
- border-radius: 999px;
21
- outline: none;
22
- cursor: pointer;
16
+ font-size: 14px;
17
+ color: ${({ theme }) => theme.variant['primary-2']};
18
+ background: ${({ theme }) => hexToRGB(theme.variant['neutral-5'], 0.7)};
19
+ border: 1px solid ${({ theme }) => hexToRGB(theme.variant['neutral-5'], 0.7)};
20
+ padding: 4px 24px;
21
+ border-radius: 999px;
22
+ outline: none;
23
+ cursor: pointer;
23
24
 
24
- ${({ selected }) => selected ? selectedCss : null}
25
+ ${({ selected }) => (selected ? selectedCss : null)}
25
26
 
26
- &:not(:first-child) {
27
- margin-left: 8px;
28
- }
27
+ &:not(:first-child) {
28
+ margin-left: 8px;
29
+ }
29
30
  `;
30
- StyledButton.defaultProps = {
31
- theme: defaultThemeColor,
32
- }
33
31
 
34
32
  export const FilterChip = ({ options, selected, onClick, ...props }) => {
33
+ const activeTheme = useTheme() || defaultThemeColor;
34
+
35
35
  const list = options.map((option, index) => {
36
36
  return (
37
- <StyledButton key={`${option.label}_${index}_${option.value}`} selected={selected === option.value} onClick={() => { onClick(option.value) }}>
37
+ <StyledButton
38
+ theme={activeTheme}
39
+ key={`${option.label}_${index}_${option.value}`}
40
+ selected={selected === option.value}
41
+ onClick={() => {
42
+ onClick(option.value);
43
+ }}
44
+ >
38
45
  {option.label}
39
46
  </StyledButton>
40
- )
41
- })
42
- return (
43
- <>
44
- {list}
45
- </>
46
- )
47
- }
47
+ );
48
+ });
49
+ return <>{list}</>;
50
+ };
48
51
 
49
52
  FilterChip.propTypes = {
50
53
  /**
@@ -59,10 +62,9 @@ FilterChip.propTypes = {
59
62
  * click event
60
63
  */
61
64
  onClick: PropTypes.func,
62
- }
65
+ };
63
66
 
64
67
  FilterChip.defaultProps = {
65
68
  options: [],
66
69
  selected: '',
67
- }
68
-
70
+ };