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.
- package/components/Accordion/Accordion.js +83 -33
- package/components/Accordion/AccordionSB.js +50 -54
- package/components/Accordion/AccordionSBfooter.js +51 -55
- package/components/ArrowBar/ArrowBar.js +6 -23
- package/components/Avatar/Avatar.js +49 -45
- package/components/Avatar/AvatarSB.js +121 -92
- package/components/Avatar/AvatarSBfooter.js +113 -92
- package/components/Banner/Banner.js +40 -35
- package/components/Breadcrumb/Breadcrumb.js +178 -163
- package/components/Button/PrimaryButton.js +15 -8
- package/components/Button/SecondaryButton.js +11 -9
- package/components/Cards/Card.js +25 -30
- package/components/Cards/CardRef.js +41 -34
- package/components/Cards/DocumentCard.js +83 -89
- package/components/Divider/Divider.js +23 -30
- package/components/Drawer/Drawer.js +46 -55
- package/components/FilterChip/FilterChip.js +34 -32
- package/components/Form/HeaderComponent.js +57 -27
- package/components/GroupAvatars/GroupAvatars.js +12 -16
- package/components/GroupButtons/GroupButtonsPopup.js +3 -9
- package/components/Images/Image.js +16 -21
- package/components/Inputs/CheckBoxInput.js +71 -33
- package/components/Inputs/DateSelect.js +22 -17
- package/components/Inputs/DropdownSelect.js +86 -30
- package/components/Inputs/DropzoneInput.js +83 -68
- package/components/Inputs/NumericInput.js +66 -63
- package/components/Inputs/PasswordInput.js +36 -27
- package/components/Inputs/RadioInput.js +55 -29
- package/components/Inputs/Signature.js +88 -38
- package/components/Inputs/TextArea.js +24 -40
- package/components/Inputs/TextInput.js +43 -28
- package/components/Inputs/TimeInput.js +92 -107
- package/components/Inputs/ToggleSwitch.js +87 -59
- package/components/Modal/ModalComp.js +61 -37
- package/components/Pagination/Pagination.js +30 -54
- package/components/ProgressBar/ProgressBar.js +57 -40
- package/components/Rating/Rating.js +8 -14
- package/components/Sidebar/Navbar.js +196 -170
- package/components/Tables/Table.js +56 -34
- package/components/Tooltip/Tooltip.js +135 -141
- package/components/Typography/Typography.js +9 -10
- package/components/constants/defaultStyle.js +38 -41
- package/dist/index.es.js +675 -596
- package/dist/index.js +660 -581
- package/package.json +1 -1
|
@@ -1,64 +1,71 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 (
|
|
12
|
-
for (const property in
|
|
13
|
-
tempObj[property] =
|
|
14
|
-
delete
|
|
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
|
|
17
|
-
tempObj[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
|
-
|
|
37
|
+
|
|
38
|
+
// custom styles
|
|
25
39
|
${({ customStyles }) => customStyles}
|
|
26
40
|
`;
|
|
27
41
|
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
38
|
+
${({ trimFileName }) => {
|
|
39
39
|
if (trimFileName) {
|
|
40
|
-
return
|
|
40
|
+
return css`
|
|
41
|
+
height: ${({ size }) => sizes[size].cardMinHeight};
|
|
42
|
+
`;
|
|
41
43
|
} else {
|
|
42
|
-
return
|
|
44
|
+
return css`
|
|
45
|
+
min-height: ${({ size }) => sizes[size].cardMinHeight};
|
|
46
|
+
`;
|
|
43
47
|
}
|
|
44
48
|
}}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
90
|
+
${({ trimFileName }) => {
|
|
78
91
|
if (trimFileName) {
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
20
|
+
const activeTheme = useTheme() || defaultThemeColor;
|
|
20
21
|
return (
|
|
21
|
-
<StyledDivider
|
|
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
|
|
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
|
-
${({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
...props
|
|
52
|
+
customStyles,
|
|
53
|
+
drawerOpen,
|
|
54
|
+
children,
|
|
55
|
+
...props
|
|
57
56
|
}) => {
|
|
58
57
|
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
25
|
+
${({ selected }) => (selected ? selectedCss : null)}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
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
|
+
};
|