groundfloor-react-ui 1.0.17 → 1.0.20

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 (32) hide show
  1. package/components/Accordion/Accordion.js +12 -6
  2. package/components/Button/PrimaryButton.js +15 -8
  3. package/components/Button/SecondaryButton.js +11 -9
  4. package/components/Cards/Card.js +25 -30
  5. package/components/Cards/DocumentCard.js +83 -89
  6. package/components/Divider/Divider.js +23 -30
  7. package/components/FilterChip/FilterChip.js +34 -32
  8. package/components/Form/HeaderComponent.js +57 -27
  9. package/components/GroupAvatars/GroupAvatars.js +12 -16
  10. package/components/GroupButtons/GroupButtonsPopup.js +3 -9
  11. package/components/Inputs/CheckBoxInput.js +71 -33
  12. package/components/Inputs/DateSelect.js +22 -17
  13. package/components/Inputs/DropdownSelect.js +86 -30
  14. package/components/Inputs/DropzoneInput.js +83 -68
  15. package/components/Inputs/NumericInput.js +66 -63
  16. package/components/Inputs/PasswordInput.js +36 -27
  17. package/components/Inputs/RadioInput.js +55 -29
  18. package/components/Inputs/Signature.js +88 -38
  19. package/components/Inputs/TextArea.js +24 -40
  20. package/components/Inputs/TextInput.js +43 -28
  21. package/components/Inputs/TimeInput.js +92 -107
  22. package/components/Inputs/ToggleSwitch.js +87 -59
  23. package/components/Modal/ModalComp.js +67 -38
  24. package/components/Pagination/Pagination.js +30 -54
  25. package/components/ProgressBar/ProgressBar.js +57 -40
  26. package/components/Rating/Rating.js +8 -14
  27. package/components/Tables/Table.js +56 -34
  28. package/components/Tooltip/Tooltip.js +135 -141
  29. package/components/constants/defaultStyle.js +28 -38
  30. package/dist/index.es.js +484 -438
  31. package/dist/index.js +483 -437
  32. package/package.json +1 -1
@@ -1,7 +1,8 @@
1
- import React, { useState, useRef } from "react";
2
1
  import PropTypes from 'prop-types';
3
- import defaultStyles from '../constants/defaultStyle';
2
+ import React, { useRef, useState } from "react";
4
3
  import { Card, CardRef } from "../Cards";
4
+ import defaultStyles from '../constants/defaultStyle';
5
+ import { Icon } from '../Icon';
5
6
 
6
7
  /**
7
8
  * Primary UI component for user interaction
@@ -45,7 +46,12 @@ export const Accordion = ({
45
46
  { transform: 'rotate(0deg)', transition: 'transform ease 95ms', background: 'transparent' }
46
47
  }
47
48
  >
48
- {icon}
49
+ {icon ? icon : <Icon
50
+ icon='chevron-down'
51
+ size={11}
52
+ transform={'translate(0px,-1px)'}
53
+ color='#A9B1B8'
54
+ />}
49
55
  </div>}
50
56
  />
51
57
  }
@@ -108,7 +114,7 @@ Accordion.propTypes = {
108
114
  Accordion.defaultProps = {
109
115
  theme: defaultStyles,
110
116
  contentToggle: 'Toggle',
111
- content: 'Content'
112
-
113
- };
117
+ content: 'Content',
118
+ toggleIconAnimation: true,
114
119
 
120
+ };
@@ -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: ${fontColor};
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: ${fontColor};
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 customStyles={{ 'background-color': fontColor }} size={16} />
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
- * custome style of button
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 ${buttonDisabledBg};
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 theme = useTheme() || defaultThemeColor;
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 customStyles={{ 'background-color': fontColor }} size={16} />
93
- </div>
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,48 +1,43 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
- import defaultStyles from '../constants/defaultStyle';
5
- import getDefaultStyles from '../constants/utils';
2
+ import React from 'react';
3
+ import styled, { useTheme } from 'styled-components';
4
+ import defaultThemeColor from '../constants/defaultThemeColor';
6
5
 
7
6
  const CardWrapper = styled.div`
8
- //Set the styles from the default styles object
9
- ${ ({ theme, type }) => {
10
- return getDefaultStyles(theme, type);
11
- }}
12
-
13
- // custom styles
14
- ${({ customStyles }) => customStyles}
7
+ color: ${({ activeTheme }) => activeTheme.textColor};
8
+ padding-top: 25px;
9
+ padding-bottom: 25px;
10
+ padding-left: 32px;
11
+ padding-right: 32px;
12
+ background-color: ${({ activeTheme }) => activeTheme.bgColor};
13
+ width: inherit;
14
+ height: inherit;
15
+ border-radius: 5px;
16
+ box-shadow: 0px 5px 37px rgba(56, 66, 100, 0.0880136);
17
+ border-color: ${({ activeTheme }) => activeTheme.border};
18
+
19
+ // custom styles
20
+ ${({ customStyles }) => customStyles}
15
21
  `;
16
22
 
17
- CardWrapper.defaultProps = {
18
- theme: defaultStyles
19
- }
23
+ export const Card = ({ type, header, content, ...props }) => {
24
+ const activeTheme = useTheme() || defaultThemeColor;
20
25
 
21
- export const Card = ({type,header,content,...props}) => {
22
26
  return (
23
- <CardWrapper theme={defaultStyles} type={'card'} {...props}>
27
+ <CardWrapper activeTheme={activeTheme} {...props}>
24
28
  {header}
25
29
  {content}
26
30
  </CardWrapper>
27
- )
28
- }
31
+ );
32
+ };
29
33
 
30
34
  Card.propTypes = {
31
35
  /**
32
- * the type of the element
33
- */
34
- type: PropTypes.string,
35
- /**
36
- * header of the card
36
+ * header of the card
37
37
  */
38
38
  header: PropTypes.any,
39
39
  /**
40
40
  * the content of the card
41
- */
41
+ */
42
42
  content: PropTypes.any,
43
- }
44
-
45
- Card.defaultProps = {
46
- type: 'card',
47
- }
48
-
43
+ };
@@ -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
+ };