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,126 +1,127 @@
1
- import React, { useEffect, useState } from "react";
2
- import ReactDom from 'react-dom'
3
- import PropTypes from 'prop-types';
4
- import styled, { css } from 'styled-components';
5
- import defaultStyles from '../constants/defaultStyle';
6
- import { AvatarSB, AvatarSBfooter } from '../Avatar'
7
- import { AccordionSB, AccordionSBfooter } from '../Accordion'
8
- import { Icon } from '../Icon'
9
-
1
+ import React, { useState } from 'react';
2
+ import styled, { useTheme } from 'styled-components';
3
+ import { AccordionSB, AccordionSBfooter } from '../Accordion';
4
+ import { AvatarSB, AvatarSBfooter } from '../Avatar';
5
+ import defaultThemeColor from '../constants/defaultThemeColor';
10
6
 
11
7
  const StyledHeader = styled.div`
12
- min-height: 51px;
13
- display: flex;
14
- background-color: #193096;
15
- align-items: center;
16
- padding-left: 24.5px;
8
+ min-height: 51px;
9
+ display: flex;
10
+ background-color: ${({ theme }) => theme.primary['primary-1']};
11
+ align-items: center;
12
+ padding-left: 24.5px;
17
13
 
18
- &::hover{
19
- &>.chevron-navbar{
20
- background-color: white;
21
- color: blue;
22
- cursor: pointer;
14
+ &::hover {
15
+ & > .chevron-navbar {
16
+ background-color: ${({ theme }) => theme.bgColor};
17
+ color: ${({ theme }) => theme.primary['primary-1']};
18
+ cursor: pointer;
23
19
  }
24
- }
25
- `
20
+ }
21
+
22
+ ${({ headerStyles }) => headerStyles}
23
+ `;
26
24
 
27
25
  const StyledBody = styled.div`
28
- display: flex;
29
- background-color: transparent;
30
- flex-direction: column;
31
- align-items: center;
32
- width: 100%;
33
- `
26
+ display: flex;
27
+ background-color: transparent;
28
+ flex-direction: column;
29
+ align-items: center;
30
+ width: 100%;
31
+ `;
34
32
 
35
33
  const ListElement = styled.div`
36
- display: flex;
37
- align-items: center;
38
- cursor: pointer;
34
+ display: flex;
35
+ align-items: center;
36
+ cursor: pointer;
39
37
 
40
- &:hover{
41
- p{
42
- text-decoration: underline
38
+ &:hover {
39
+ p {
40
+ ${({ listElementStyle }) => listElementStyle}
43
41
  }
44
- }
42
+ }
45
43
 
46
- span{
44
+ span {
47
45
  width: 7px;
48
46
  height: 7px;
49
47
  border-radius: 50%;
50
- background-color: white;
48
+ background-color: ${({ theme }) => theme.bgColor};
51
49
  margin-right: 31px;
52
- }
50
+ }
53
51
 
54
- p{
52
+ p {
55
53
  margin: 8.25px 0;
56
- }
57
- `
54
+ }
55
+ `;
58
56
 
59
57
  const StyledFooter = styled.div`
60
- display: flex;
61
- background-color: transparent;
62
- flex-direction: column;
63
- align-items: center;
64
- width: 100%;
65
- margin-top: auto;
66
- `
58
+ display: flex;
59
+ background-color: transparent;
60
+ flex-direction: column;
61
+ align-items: center;
62
+ width: 100%;
63
+ margin-top: auto;
64
+ `;
67
65
 
68
66
  const ListElementFooter = styled.div`
69
- display: flex;
70
- align-items: center;
71
- cursor: pointer;
67
+ display: flex;
68
+ align-items: center;
69
+ cursor: pointer;
72
70
 
73
- &:hover{
74
- p{
75
- text-decoration: underline
71
+ &:hover {
72
+ p {
73
+ ${({ listElementStyle }) => listElementStyle}
76
74
  }
77
- }
75
+ }
78
76
 
79
- span{
77
+ span {
80
78
  width: 7px;
81
79
  height: 7px;
82
80
  border-radius: 50%;
83
- background-color: white;
81
+ background-color: ${({ theme }) => theme.bgColor};
84
82
  margin-right: 31px;
85
- }
83
+ }
86
84
 
87
- p{
85
+ p {
88
86
  margin: 8.25px 0;
89
- }
90
- `
87
+ }
88
+ `;
91
89
 
92
90
  export const Navbar = ({
93
- theme,
94
91
  headerContent,
95
92
  bodyContent,
96
93
  footerContent,
97
94
  selectedApp,
98
95
  setApp,
99
96
  toggleSideBarOpen,
97
+ headerStyles,
98
+ selectedStyle,
99
+ notSelectedStyle,
100
+ customStylesNameHover,
101
+ listElementStyle,
100
102
  ...props
101
103
  }) => {
104
+ const activeTheme = useTheme() || defaultThemeColor;
102
105
 
103
106
  const [accordionOpen, setAccordionOpen] = useState(null);
104
107
  const [accordionFooterOpen, setAccordionFooterOpen] = useState(null);
105
108
 
106
109
  function handleClick(index) {
107
- setAccordionFooterOpen(null)
108
- setAccordionOpen(index)
110
+ setAccordionFooterOpen(null);
111
+ setAccordionOpen(index);
109
112
  }
110
113
 
111
114
  function handleClickFooter(index) {
112
- setAccordionOpen(null)
113
- setAccordionFooterOpen(index)
115
+ setAccordionOpen(null);
116
+ setAccordionFooterOpen(index);
114
117
  }
115
118
 
116
119
  return (
117
120
  <div
118
- onMouseLeave={
119
- () => {
120
- setAccordionOpen(null)
121
- setAccordionFooterOpen(null)
122
- }
123
- }
121
+ onMouseLeave={() => {
122
+ setAccordionOpen(null);
123
+ setAccordionFooterOpen(null);
124
+ }}
124
125
  style={{
125
126
  display: 'flex',
126
127
  flexDirection: 'column',
@@ -128,84 +129,105 @@ export const Navbar = ({
128
129
  }}
129
130
  className={'NavbarDiv'}
130
131
  >
131
- <StyledHeader>
132
+ <StyledHeader theme={activeTheme} headerStyles={headerStyles}>
132
133
  {headerContent}
133
134
  </StyledHeader>
134
135
  <StyledBody>
135
136
  {bodyContent?.map((app, i) => {
136
- return (<AccordionSB
137
- key={app.id}
138
- index={i}
139
- handleClick={(index) => { handleClick(index) }}
140
- isAccordionOpen={i === accordionOpen}
141
- isSelected={app.userName === selectedApp.lev1}
142
- customStylesAccordionContainer={{
143
- padding: '0',
144
- 'box-shadow': 'none',
145
- 'border-radius': '0px',
146
- 'background-color': 'transparent',
147
- }}
148
- customStylesAccordionTogggle={{
149
- padding: '0',
150
- 'box-shadow': 'none',
151
- 'border-radius': '0px',
152
- 'background-color': 'transparent',
153
- 'padding-left': '16px',
154
- 'padding-top': '7.5px',
155
- 'padding-bottom': '7.5px',
156
- cursor: 'pointer',
157
- }}
158
- customStylesAccordionContent={{
159
- transition: 'height ease 0.2s', //transform ease 95ms',
160
- overflow: 'hidden',
161
- padding: '0',
162
- 'background-color': 'transparent',
163
- color: 'white',
164
- position: 'relative',
165
- 'box-shadow': 'none',
166
- }}
167
- contentToggle={
168
- <AvatarSB
169
- toggleName={toggleSideBarOpen}//isOpen} //true}
170
- customStylesName={{
171
- 'white-space': 'nowrap',
172
- 'overflow': 'hidden',
173
- 'text-overflow': 'ellipsis',
174
- 'color': 'white',
175
- 'font-weight': app.userName === selectedApp.lev1 ? '600' : '400',
176
- }}
177
- customStylesNameHover={{
178
- 'text-decoration': 'underline',
179
- }}
180
- size={'LG'}
181
- user={app}
182
- isSelected={app.userName === selectedApp.lev1}
183
- />
184
- }
185
- content={
186
- <div style={{ margin: '0', padding: '0', paddingLeft: '32px', marginBottom: '18.25px' }}>
187
- {app.subdirectory?.map((sub, i) => {
188
- return (
189
- <ListElement
190
- key={app.id + sub}
191
- onClick={() => {
192
- console.log("Click: ", app.fullName, sub)
193
- setApp({ lev1: `${app.userName}`, lev2: `${sub}` })
194
- }}>
195
- <span style={{ visibility: selectedApp.lev2 === sub ? 'visible' : 'hidden' }}></span>
196
- <p style={{ marginTop: i === 0 && '0px' }}>{sub}</p>
197
- </ListElement>
198
- )
199
- })}
200
- </div>
201
- }
202
- />)
137
+ return (
138
+ <AccordionSB
139
+ key={app.id}
140
+ index={i}
141
+ handleClick={(index) => {
142
+ handleClick(index);
143
+ }}
144
+ isAccordionOpen={i === accordionOpen}
145
+ isSelected={app.userName === selectedApp.lev1}
146
+ customStylesAccordionContainer={{
147
+ padding: '0',
148
+ 'box-shadow': 'none',
149
+ 'border-radius': '0px',
150
+ 'background-color': 'transparent',
151
+ }}
152
+ customStylesAccordionTogggle={{
153
+ padding: '0',
154
+ 'box-shadow': 'none',
155
+ 'border-radius': '0px',
156
+ 'background-color': 'transparent',
157
+ 'padding-left': '16px',
158
+ 'padding-top': '7.5px',
159
+ 'padding-bottom': '7.5px',
160
+ cursor: 'pointer',
161
+ }}
162
+ customStylesAccordionContent={{
163
+ transition: 'height ease 0.2s', //transform ease 95ms',
164
+ overflow: 'hidden',
165
+ padding: '0',
166
+ 'background-color': 'transparent',
167
+ color: 'white',
168
+ position: 'relative',
169
+ 'box-shadow': 'none',
170
+ }}
171
+ contentToggle={
172
+ <AvatarSB
173
+ selectedStyle={selectedStyle}
174
+ notSelectedStyle={notSelectedStyle}
175
+ toggleName={toggleSideBarOpen} //isOpen} //true}
176
+ customStylesName={{
177
+ 'white-space': 'nowrap',
178
+ overflow: 'hidden',
179
+ 'text-overflow': 'ellipsis',
180
+ color: 'white',
181
+ 'font-weight':
182
+ app.userName === selectedApp.lev1 ? '600' : '400',
183
+ }}
184
+ customStylesNameHover={customStylesNameHover}
185
+ size={'LG'}
186
+ user={app}
187
+ isSelected={app.userName === selectedApp.lev1}
188
+ />
189
+ }
190
+ content={
191
+ <div
192
+ style={{
193
+ margin: '0',
194
+ padding: '0',
195
+ paddingLeft: '32px',
196
+ marginBottom: '18.25px',
197
+ }}
198
+ >
199
+ {app.subdirectory?.map((sub, i) => {
200
+ return (
201
+ <ListElement
202
+ listElementStyle={listElementStyle}
203
+ key={app.id + sub}
204
+ onClick={() => {
205
+ console.log('Click: ', app.fullName, sub);
206
+ setApp({ lev1: `${app.userName}`, lev2: `${sub}` });
207
+ }}
208
+ >
209
+ <span
210
+ style={{
211
+ visibility:
212
+ selectedApp.lev2 === sub ? 'visible' : 'hidden',
213
+ }}
214
+ ></span>
215
+ <p style={{ marginTop: i === 0 && '0px' }}>{sub}</p>
216
+ </ListElement>
217
+ );
218
+ })}
219
+ </div>
220
+ }
221
+ />
222
+ );
203
223
  })}
204
224
  </StyledBody>
205
225
  <StyledFooter>
206
226
  <AccordionSBfooter
207
227
  index={0}
208
- handleClick={(index) => { handleClickFooter(index) }}
228
+ handleClick={(index) => {
229
+ handleClickFooter(index);
230
+ }}
209
231
  isAccordionOpen={0 === accordionFooterOpen}
210
232
  customStylesAccordionContainer={{
211
233
  padding: '0',
@@ -234,36 +256,41 @@ export const Navbar = ({
234
256
  }}
235
257
  contentToggle={
236
258
  <AvatarSB
237
- toggleName={toggleSideBarOpen}//isOpen}//} //true}
259
+ selectedStyle={selectedStyle}
260
+ notSelectedStyle={notSelectedStyle}
261
+ toggleName={toggleSideBarOpen} //isOpen}//} //true}
238
262
  customStylesName={{
239
263
  'white-space': 'nowrap',
240
- 'overflow': 'hidden',
264
+ overflow: 'hidden',
241
265
  'text-overflow': 'ellipsis',
242
- 'color': 'white',
266
+ color: 'white',
243
267
  'font-weight': '400',
244
268
  }}
245
- customStylesNameHover={{
246
- 'text-decoration': 'underline',
247
- }}
269
+ customStylesNameHover={customStylesNameHover}
248
270
  size={'LG'}
249
- user={
250
- {
251
- fullName: 'My Account',
252
- userName: 'My Account',
253
- url: "https://picsum.photos/30"
254
- }
255
- }
271
+ user={{
272
+ fullName: 'My Account',
273
+ userName: 'My Account',
274
+ url: 'https://picsum.photos/30',
275
+ }}
256
276
  />
257
277
  }
258
278
  content={
259
- <div style={{ margin: '0', padding: '0', paddingLeft: '32px', marginBottom: '18.25px' }}>
279
+ <div
280
+ style={{
281
+ margin: '0',
282
+ padding: '0',
283
+ paddingLeft: '32px',
284
+ marginBottom: '18.25px',
285
+ }}
286
+ >
260
287
  <ListElementFooter
261
- onClick={() => {
262
- }}>
288
+ listElementStyle={listElementStyle}
289
+ onClick={() => { }}
290
+ >
263
291
  <p>Change Password</p>
264
292
  </ListElementFooter>
265
- <ListElementFooter
266
- onClick={() => { }}>
293
+ <ListElementFooter onClick={() => { }}>
267
294
  <p>Sign Out</p>
268
295
  </ListElementFooter>
269
296
  </div>
@@ -298,24 +325,24 @@ export const Navbar = ({
298
325
  }}
299
326
  contentToggle={
300
327
  <AvatarSBfooter
301
- toggleName={toggleSideBarOpen}//isOpen} //true}
328
+ selectedStyle={selectedStyle}
329
+ notSelectedStyle={notSelectedStyle}
330
+ toggleName={toggleSideBarOpen} //isOpen} //true}
302
331
  customStylesName={{
303
332
  'white-space': 'nowrap',
304
- 'overflow': 'hidden',
333
+ overflow: 'hidden',
305
334
  'text-overflow': 'ellipsis',
306
- 'color': 'white',
335
+ color: 'white',
307
336
  'font-weight': '400',
308
337
  }}
309
338
  customStylesNameHover={{
310
339
  'text-decoration': 'underline',
311
340
  }}
312
341
  size={'LG'}
313
- user={
314
- {
315
- fullName: 'Users',
316
- userName: 'Users',
317
- }
318
- }
342
+ user={{
343
+ fullName: 'Users',
344
+ userName: 'Users',
345
+ }}
319
346
  value={'+' + footerContent.length}
320
347
  />
321
348
  }
@@ -323,6 +350,5 @@ export const Navbar = ({
323
350
  />
324
351
  </StyledFooter>
325
352
  </div>
326
- )
327
- }
328
-
353
+ );
354
+ };
@@ -1,16 +1,24 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import DataTable from "react-data-table-component";
2
+ import React from 'react';
3
+ import DataTable from 'react-data-table-component';
4
+ import styled, { useTheme } from 'styled-components';
4
5
  import defaultStyles from '../constants/defaultStyle';
6
+ import defaultThemeColor from '../constants/defaultThemeColor';
5
7
  import { Icon } from '../Icon';
6
8
 
7
9
  /**
8
10
  * Primary UI component for user interaction
9
11
  */
10
12
 
13
+ const WrapperDiv = styled.div`
14
+ .form-check-input {
15
+ accent-color: ${({ theme }) => theme.primary['primary-1']};
16
+ }
17
+ `;
18
+
11
19
  export const Table = ({
12
- theme,
13
20
  customStyles,
21
+ inBuiltCss,
14
22
  type = 'table',
15
23
  sortIcon,
16
24
  data,
@@ -24,26 +32,40 @@ export const Table = ({
24
32
  conditionalRowStyles,
25
33
  fixedHeader,
26
34
  fixedHeaderScrollHeight,
27
- ...props }) => {
28
-
29
- let tableStyle = {}
30
-
31
- if (theme) {
32
- if (theme[type]) {
33
-
34
- tableStyle = theme[type];
35
+ checkboxColor,
36
+ ...props
37
+ }) => {
38
+ let tableStyle = {};
39
+
40
+ if (inBuiltCss) {
41
+ if (inBuiltCss[type]) {
42
+ tableStyle = inBuiltCss[type];
35
43
  }
36
44
  }
37
45
 
38
-
39
46
  if (customStyles) {
40
47
  for (const property in customStyles) {
41
- tableStyle[property] = customStyles[property]
48
+ tableStyle[property] = customStyles[property];
42
49
  }
43
50
  }
44
51
 
45
- return (
52
+ const activeTheme = useTheme() || defaultThemeColor;
53
+
54
+ const Checkbox = React.forwardRef(({ onClick, ...rest }, ref) => {
55
+ return (
56
+ <WrapperDiv theme={activeTheme}>
57
+ <input
58
+ type='checkbox'
59
+ className='form-check-input'
60
+ ref={ref}
61
+ onClick={onClick}
62
+ {...rest}
63
+ />
64
+ </WrapperDiv>
65
+ );
66
+ });
46
67
 
68
+ return (
47
69
  <DataTable
48
70
  responsive={responsive}
49
71
  data={data}
@@ -57,25 +79,22 @@ export const Table = ({
57
79
  progressComponent={progressComponent ? progressComponent : undefined}
58
80
  sortServer={sortServer}
59
81
  onSort={(columnInfo, direction, event) => {
60
- handleOnSort(columnInfo, direction, event)
82
+ handleOnSort(columnInfo, direction, event);
61
83
  }}
62
84
  conditionalRowStyles={conditionalRowStyles}
63
85
  fixedHeader={fixedHeader}
64
86
  fixedHeaderScrollHeight={fixedHeaderScrollHeight}
87
+ selectableRowsComponent={Checkbox}
65
88
  {...props}
66
89
  />
67
-
68
-
69
-
70
-
71
90
  );
72
91
  };
73
92
 
74
93
  Table.propTypes = {
75
94
  /**
76
- * Theme object
95
+ * inBuiltCss object
77
96
  */
78
- theme: PropTypes.object,
97
+ inBuiltCss: PropTypes.object,
79
98
  /**
80
99
  * Optional component to override the default sorting icon (must be downward)
81
100
  */
@@ -121,7 +140,7 @@ Table.propTypes = {
121
140
  */
122
141
  fixedHeader: PropTypes.bool,
123
142
  /**
124
- * Optional to set height of the table
143
+ * Optional to set height of the table
125
144
  */
126
145
  fixedHeaderScrollHeight: PropTypes.string,
127
146
  /**
@@ -133,24 +152,27 @@ Table.propTypes = {
133
152
  };
134
153
 
135
154
  Table.defaultProps = {
136
- theme: defaultStyles,
137
- sortIcon: <Icon
138
- icon={'arrow-down'}
139
- size={11}
140
- color={'#333333'}
141
- style={{
142
- transform: 'scaleX(0.7) scaleY(0.7) translate(5px, -3px)',
143
- }}
144
- />,
155
+ inBuiltCss: defaultStyles,
156
+ sortIcon: (
157
+ <Icon
158
+ icon={'arrow-down'}
159
+ size={11}
160
+ color={'#333333'}
161
+ style={{
162
+ transform: 'scaleX(0.7) scaleY(0.7) translate(5px, -3px)',
163
+ }}
164
+ />
165
+ ),
145
166
  data: [],
146
167
  tableColumns: [],
147
168
  progressPending: false,
148
169
  defaultSortFieldId: null,
149
- handleOnSort: (columnInfo, direction, event) => { console.log(columnInfo, direction, event) },
170
+ handleOnSort: (columnInfo, direction, event) => {
171
+ console.log(columnInfo, direction, event);
172
+ },
150
173
  sortServer: null,
151
174
  progressComponent: undefined,
152
175
  responsive: true,
153
176
  fixedHeader: true,
154
177
  fixedHeaderScrollHeight: '100vh',
155
- };
156
-
178
+ };