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,5 +1,5 @@
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, { css, useTheme } from 'styled-components';
4
4
  import defaultThemeColor from '../constants/defaultThemeColor';
5
5
 
@@ -8,185 +8,200 @@ import defaultThemeColor from '../constants/defaultThemeColor';
8
8
  */
9
9
 
10
10
  const StyledBreadcrumb = styled.div`
11
- background: transparent;
12
- color: ${({ theme, variant }) => theme.variant[variant]};
13
- font-size: ${({ isPrimary }) => isPrimary ? '16px' : '14px'};
14
- display: flex;
15
- align-items: center;
16
-
17
- ${({ isWrap }) => {
18
- if (isWrap) {
19
- return css`
20
- width: ${({ block }) => block ? 'auto' : 'fit-content'};
21
- flex-wrap: wrap;
22
- visibility: visible;
23
- `
24
- } else {
25
- return css`
26
- border: 1px solid transparent;
27
- overflow-x: auto;
28
- overflow-y: hidden;
29
- visibility: ${({ isBreadcrumbVisible }) => isBreadcrumbVisible ? 'visible' : 'hidden'};
30
- /* Hide scrollbar for Chrome, Safari and Opera */
31
- &::-webkit-scrollbar {
32
- display: none;
33
- }
34
- /* Hide scrollbar for IE, Edge and Firefox */
35
- &-ms-overflow-style: none; /* IE and Edge */
36
- scrollbar-width: none; /* Firefox */
37
- `
11
+ background: transparent;
12
+ color: ${({ theme, variant }) => theme.variant[variant]};
13
+ font-size: ${({ isPrimary }) => (isPrimary ? '16px' : '14px')};
14
+ display: flex;
15
+ align-items: center;
16
+
17
+ ${({ isWrap }) => {
18
+ if (isWrap) {
19
+ return css`
20
+ width: ${({ block }) => (block ? 'auto' : 'fit-content')};
21
+ flex-wrap: wrap;
22
+ visibility: visible;
23
+ `;
24
+ } else {
25
+ return css`
26
+ border: 1px solid transparent;
27
+ overflow-x: auto;
28
+ overflow-y: hidden;
29
+ visibility: ${({ isBreadcrumbVisible }) =>
30
+ isBreadcrumbVisible ? 'visible' : 'hidden'};
31
+ /* Hide scrollbar for Chrome, Safari and Opera */
32
+ &::-webkit-scrollbar {
33
+ display: none;
38
34
  }
39
- }};
40
-
41
- .breadcrumb-icon svg path {
42
- fill: ${({ theme, variant }) => theme.variant[variant]};
35
+ /* Hide scrollbar for IE, Edge and Firefox */
36
+ &-ms-overflow-style: none; /* IE and Edge */
37
+ scrollbar-width: none; /* Firefox */
38
+ `;
43
39
  }
40
+ }};
44
41
 
45
- .breadcrumb-icon-separator svg path {
46
- fill: ${({ theme, variantSeparator }) => theme.variant[variantSeparator]};
47
- }
42
+ .breadcrumb-icon svg path {
43
+ fill: ${({ theme, variant }) => theme.variant[variant]};
44
+ }
48
45
 
49
- .breadcrumb-icon-separator {
50
- margin: 0 ${({ isPrimary }) => isPrimary ? '12px' : '7px'};
51
- }
46
+ .breadcrumb-icon-separator svg path {
47
+ fill: ${({ theme, variantSeparator }) => theme.variant[variantSeparator]};
48
+ }
49
+
50
+ .breadcrumb-icon-separator {
51
+ margin: 0 ${({ isPrimary }) => (isPrimary ? '12px' : '7px')};
52
+ }
52
53
  `;
53
54
 
54
55
  const StyledCombo = styled.div`
55
- display: flex;
56
- flex-wrap: nowrap;
56
+ display: flex;
57
+ flex-wrap: nowrap;
57
58
  `;
58
59
 
59
60
  const StyledItem = styled.div`
60
- cursor: ${({ href }) => href ? 'pointer' : 'default'};
61
- list-style: none;
62
- color: ${({ theme, variant }) => theme.variant[variant]};
63
- white-space: nowrap;
64
- max-width: 15ch;
65
- white-space: nowrap;
66
- overflow: hidden;
67
- text-overflow: ellipsis;
68
-
69
- &:hover {
70
- text-decoration: ${({ href }) => href ? 'underline' : 'none'};
71
- }
61
+ cursor: ${({ href }) => (href ? 'pointer' : 'default')};
62
+ list-style: none;
63
+ color: ${({ theme, variant }) => theme.variant[variant]};
64
+ white-space: nowrap;
65
+ max-width: 15ch;
66
+ white-space: nowrap;
67
+ overflow: hidden;
68
+ text-overflow: ellipsis;
69
+
70
+ &:hover {
71
+ text-decoration: ${({ href }) => (href ? 'underline' : 'none')};
72
+ }
72
73
  `;
73
74
 
74
- export const Breadcrumb = ({ wrap, block, style, variant, variantSeparator, appLogo, separator, items, onClick, isPrimary, ...props }) => {
75
- const theme = useTheme() || defaultThemeColor;
76
-
77
- const breadcrumbRef = useRef(null)
78
-
79
- const [isBreadcrumbVisible, setIsBreadcrumbVisible] = useState(undefined);
80
-
81
- const handleWindowResize = () => {
82
- if (breadcrumbRef?.current?.scrollWidth < breadcrumbRef?.current?.offsetWidth) {
83
- setIsBreadcrumbVisible(true)
84
- } else {
85
- setIsBreadcrumbVisible(false)
86
- }
75
+ export const Breadcrumb = ({
76
+ wrap,
77
+ block,
78
+ style,
79
+ variant,
80
+ variantSeparator,
81
+ appLogo,
82
+ separator,
83
+ items,
84
+ onClick,
85
+ isPrimary,
86
+ ...props
87
+ }) => {
88
+ const activeTheme = useTheme() || defaultThemeColor;
89
+
90
+ const breadcrumbRef = useRef(null);
91
+
92
+ const [isBreadcrumbVisible, setIsBreadcrumbVisible] = useState(undefined);
93
+
94
+ const handleWindowResize = () => {
95
+ if (
96
+ breadcrumbRef?.current?.scrollWidth < breadcrumbRef?.current?.offsetWidth
97
+ ) {
98
+ setIsBreadcrumbVisible(true);
99
+ } else {
100
+ setIsBreadcrumbVisible(false);
87
101
  }
88
-
89
- useEffect(() => {
90
- handleWindowResize();
91
- }, [items])
92
-
93
- //On component mount add event listener
94
- useEffect(() => {
95
- if (!wrap) {
96
- // Monitor the width of the viewPort to adjust the text of the arrow accordingly
97
- window.addEventListener("resize", handleWindowResize);
98
- return () => (window.removeEventListener("resize", handleWindowResize));
99
- }
100
- }, [])
101
-
102
- const list = (items) ? items.map((item, i) => {
103
- return (
104
- <StyledCombo key={item.label} >
105
- {(i === 0 && !appLogo) ? null : (<div className="breadcrumb-icon-separator">{separator}</div>)}
106
- <StyledItem onClick={() => { if (item.href) onClick(item.href) }} variant={variant} href={item.href} title={item.label}>
107
- {/* If label longer than 15chs trim it by css */}
108
- {item.label}
109
- </StyledItem>
110
- </StyledCombo>
111
- )
112
- }) : (null)
113
-
114
- return (
115
- <StyledBreadcrumb
116
- isWrap={wrap}
117
- ref={!wrap ? breadcrumbRef : null}
118
- isBreadcrumbVisible={isBreadcrumbVisible}
119
- block={block}
102
+ };
103
+
104
+ useEffect(() => {
105
+ handleWindowResize();
106
+ }, [items]);
107
+
108
+ //On component mount add event listener
109
+ useEffect(() => {
110
+ if (!wrap) {
111
+ // Monitor the width of the viewPort to adjust the text of the arrow accordingly
112
+ window.addEventListener('resize', handleWindowResize);
113
+ return () => window.removeEventListener('resize', handleWindowResize);
114
+ }
115
+ }, []);
116
+
117
+ const list = items
118
+ ? items.map((item, i) => {
119
+ return (
120
+ <StyledCombo key={item.label}>
121
+ {i === 0 && !appLogo ? null : (
122
+ <div className='breadcrumb-icon-separator'>{separator}</div>
123
+ )}
124
+ <StyledItem
125
+ theme={activeTheme}
126
+ onClick={() => {
127
+ if (item.href) onClick(item.href);
128
+ }}
120
129
  variant={variant}
121
- variantSeparator={variantSeparator}
122
- style={style}
123
- isPrimary={isPrimary}
124
- {...props}
125
- >
126
- {appLogo && (<div className="breadcrumb-icon">{appLogo}</div>)}
127
- {list}
128
- </StyledBreadcrumb>
129
- )
130
+ href={item.href}
131
+ title={item.label}
132
+ >
133
+ {/* If label longer than 15chs trim it by css */}
134
+ {item.label}
135
+ </StyledItem>
136
+ </StyledCombo>
137
+ );
138
+ })
139
+ : null;
140
+
141
+ return (
142
+ <StyledBreadcrumb
143
+ theme={activeTheme}
144
+ isWrap={wrap}
145
+ ref={!wrap ? breadcrumbRef : null}
146
+ isBreadcrumbVisible={isBreadcrumbVisible}
147
+ block={block}
148
+ variant={variant}
149
+ variantSeparator={variantSeparator}
150
+ style={style}
151
+ isPrimary={isPrimary}
152
+ {...props}
153
+ >
154
+ {appLogo && <div className='breadcrumb-icon'>{appLogo}</div>}
155
+ {list}
156
+ </StyledBreadcrumb>
157
+ );
130
158
  };
131
159
 
132
160
  Breadcrumb.propTypes = {
133
- /**
134
- * Color of text. primary-1, 2, error, etc.
135
- */
136
- variant: PropTypes.string,
137
- /**
138
- * Color of separator. primary-1, 2, error, etc.
139
- */
140
- variantSeparator: PropTypes.string,
141
- /**
142
- * Click handler
143
- */
144
- onClick: PropTypes.func,
145
- /**
146
- * Optional Icon element with app icon
147
- */
148
- appLogo: PropTypes.any,
149
- /**
150
- * Optional Icon element with separator icon
151
- */
152
- separator: PropTypes.any,
153
- /**
154
- * List of the elements of breadcramb
155
- */
156
- items: PropTypes.array,
157
- /**
158
- * Optional width selector
159
- */
160
- block: PropTypes.bool,
161
- /**
162
- * Theme object
163
- */
164
- theme: PropTypes.object,
165
- /**
166
- * If true wrap items when shrink else hide
167
- */
168
- wrap: PropTypes.bool,
169
- /**
170
- * If true bigger font and margin, if false it means secondary breadcrum with smaller font and less margin
171
- */
172
- isPrimary: PropTypes.bool,
161
+ /**
162
+ * Color of text. primary-1, 2, error, etc.
163
+ */
164
+ variant: PropTypes.string,
165
+ /**
166
+ * Color of separator. primary-1, 2, error, etc.
167
+ */
168
+ variantSeparator: PropTypes.string,
169
+ /**
170
+ * Click handler
171
+ */
172
+ onClick: PropTypes.func,
173
+ /**
174
+ * Optional Icon element with app icon
175
+ */
176
+ appLogo: PropTypes.any,
177
+ /**
178
+ * Optional Icon element with separator icon
179
+ */
180
+ separator: PropTypes.any,
181
+ /**
182
+ * List of the elements of breadcramb
183
+ */
184
+ items: PropTypes.array,
185
+ /**
186
+ * Optional width selector
187
+ */
188
+ block: PropTypes.bool,
189
+
190
+ /**
191
+ * If true wrap items when shrink else hide
192
+ */
193
+ wrap: PropTypes.bool,
194
+ /**
195
+ * If true bigger font and margin, if false it means secondary breadcrum with smaller font and less margin
196
+ */
197
+ isPrimary: PropTypes.bool,
173
198
  };
174
199
 
175
- StyledBreadcrumb.defaultProps = {
176
- theme: defaultThemeColor,
177
- }
178
-
179
- StyledItem.defaultProps = {
180
- theme: defaultThemeColor,
181
- }
182
-
183
200
  Breadcrumb.defaultProps = {
184
- theme: defaultThemeColor,
185
- variant: 'neutral-2',
186
- variantSeparator: 'neutral-3',
187
- block: false,
188
- onClick: undefined,
189
- wrap: false,
190
- isPrimary: true
191
- };
192
-
201
+ variant: 'neutral-2',
202
+ variantSeparator: 'neutral-3',
203
+ block: false,
204
+ onClick: undefined,
205
+ wrap: false,
206
+ isPrimary: true,
207
+ };
@@ -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
+ };