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,13 +1,13 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
2
+ import React from 'react';
4
3
  import Select, { components } from 'react-select';
5
- import defaultThemeColor from '../constants/defaultThemeColor';
4
+ import AsyncSelect from 'react-select/async';
5
+ import styled, { useTheme } from 'styled-components';
6
6
  import defaultStyles from '../constants/defaultStyle';
7
+ import defaultThemeColor from '../constants/defaultThemeColor';
7
8
  import getDefaultStyles from '../constants/utils';
8
- import { Label } from '../Label';
9
9
  import { Icon } from '../Icon';
10
- import AsyncSelect from 'react-select/async';
10
+ import { Label } from '../Label';
11
11
 
12
12
  const Wrapper = styled.div`
13
13
 
@@ -57,7 +57,7 @@ const Wrapper = styled.div`
57
57
 
58
58
  .master-dropdown__option,
59
59
  .new-select__option {
60
- color: ${defaultThemeColor.textColor};
60
+ color: ${({ theme }) => theme.textColor};
61
61
  padding-top: 3px;
62
62
  padding-bottom: 3px;
63
63
  margin: 8px 0;
@@ -71,7 +71,7 @@ const Wrapper = styled.div`
71
71
  .master-dropdown__option:hover,
72
72
  .new-select__option--is-focused,
73
73
  .new-select__option:hover {
74
- background-color: ${defaultThemeColor.neutral['neutral-5']};
74
+ background-color: ${({ theme }) => theme.neutral['neutral-5']};
75
75
  cursor: pointer;
76
76
  }
77
77
 
@@ -115,12 +115,12 @@ const Wrapper = styled.div`
115
115
 
116
116
 
117
117
  .text-main-alt {
118
- color: ${defaultThemeColor.textColor} !important;
118
+ color:${({ theme }) => theme.textColor} !important;
119
119
  margin-right: 2px;
120
120
  }
121
121
  .text-more-alt{
122
122
  font-size:12px;
123
- color:#6B747F
123
+ color: ${({ theme }) => theme.neutral['neutral-2']};
124
124
 
125
125
  }
126
126
  .css-mohuvp-dummyInput-DummyInput{
@@ -143,16 +143,23 @@ const Wrapper = styled.div`
143
143
  margin:0px;
144
144
  padding:0px;
145
145
  }
146
-
146
+ .new-select__control:hover,
147
+ .new-select__control--is-focused {
148
+ border: 1px solid ${({ theme }) => theme.primary['primary-1']};
149
+ }
147
150
  `;
148
151
 
152
+ Wrapper.defaultProps = {
153
+ theme: defaultThemeColor,
154
+ };
155
+
149
156
  const LabelWrapper = styled.div`
150
157
  // Default style
151
158
  display: flex;
152
159
 
153
160
  //Set the styles from the default styles object
154
- ${({ theme, labelWrapperStyle }) => {
155
- return getDefaultStyles(theme, labelWrapperStyle);
161
+ ${({ inBuiltCss, labelWrapperStyle }) => {
162
+ return getDefaultStyles(inBuiltCss, labelWrapperStyle);
156
163
  }}
157
164
  // custom styles
158
165
  ${({ customLabelStyles }) => customLabelStyles}
@@ -164,31 +171,36 @@ const IconDiv = styled.div`
164
171
  `;
165
172
 
166
173
  export const DropdownSelect = ({
167
- customWrapperStyles,
168
- customLabelStyles,
169
- labelStyle,
170
174
  label,
171
- isRequired,
175
+ labelStyle,
172
176
  optionArr,
173
177
  selectedValue,
174
178
  setSelectedValue,
175
179
  placeHolder,
176
- dropdownType,
177
- isDisabled,
178
- isValid,
179
- clearSelected,
180
180
  isClearable,
181
- isLoading,
181
+ isValid,
182
182
  height,
183
183
  fontSize,
184
184
  loadOptions,
185
185
  onInputChange,
186
+ clearSelected,
187
+ customWrapperStyles,
188
+ customLabelStyles,
189
+ isRequired,
190
+ dropdownType,
191
+ isDisabled,
192
+
193
+ isLoading,
194
+
186
195
  ...props
187
196
  }) => {
197
+
198
+ const activeTheme = useTheme() || defaultThemeColor
199
+
188
200
  const DropdownIndicator = (p) => {
189
201
  return (
190
202
  <components.DropdownIndicator {...p}>
191
- {true ? (
203
+ {isClearable ? (
192
204
  <IconDiv
193
205
  onClick={() => {
194
206
  clearSelected();
@@ -218,7 +230,7 @@ export const DropdownSelect = ({
218
230
  <div
219
231
  style={{
220
232
  ...checkboxStyle,
221
- backgroundColor: p?.data?.color ?? '#2E56F4',
233
+ backgroundColor: p?.data?.color ?? activeTheme.primary['primary-1'],
222
234
  }}
223
235
  >
224
236
  <Icon icon='check-icon' color='white' />
@@ -265,8 +277,10 @@ export const DropdownSelect = ({
265
277
  control: (base, state) => ({
266
278
  ...base,
267
279
  border: !isValid
268
- ? '1px solid ' + defaultThemeColor.ui['error']
269
- : '1px solid ' + defaultThemeColor.border,
280
+ ? '1px solid ' + activeTheme.ui['error']
281
+ : '1px solid ' + activeTheme.border,
282
+ // border: state.isFocused ? '4px solid red' : '4px solid green',
283
+
270
284
  height: `${height}px`,
271
285
  minHeight: `${height}px`,
272
286
  boxShadow: (state.isSelected || state.isFocused) && 'none',
@@ -319,7 +333,7 @@ export const DropdownSelect = ({
319
333
  option: (provided, state) => ({
320
334
  ...provided,
321
335
  backgroundColor:
322
- state.isSelected || state.isFocused ? '#F0F3F8' : 'white',
336
+ state.isSelected || state.isFocused ? activeTheme.neutral['neutral-5'] : activeTheme.bgColor,
323
337
  padding: '10px',
324
338
  cursor: 'pointer',
325
339
  color: '#081348',
@@ -327,15 +341,14 @@ export const DropdownSelect = ({
327
341
  ...props.styles,
328
342
  };
329
343
  return (
330
- <Wrapper style={customWrapperStyles} isValid={isValid} fontSize={fontSize}>
344
+ <Wrapper style={customWrapperStyles} isValid={isValid} fontSize={fontSize} theme={activeTheme}>
331
345
  {label && (
332
346
  <LabelWrapper
333
- theme={defaultStyles}
347
+ inBuiltCss={defaultStyles}
334
348
  labelWrapperStyle={'selectComp-label-wrapper'}
335
349
  style={customLabelStyles}
336
350
  >
337
351
  <Label
338
- themeColor={defaultThemeColor}
339
352
  customStyles={labelStyle}
340
353
  type={'label-text'}
341
354
  text={label}
@@ -345,7 +358,7 @@ export const DropdownSelect = ({
345
358
  <div
346
359
  style={{
347
360
  marginLeft: '4px',
348
- color: `${defaultThemeColor.ui['error']}`,
361
+ color: `${activeTheme.ui['error']}`,
349
362
  }}
350
363
  >
351
364
  *
@@ -498,6 +511,43 @@ DropdownSelect.propTypes = {
498
511
  * onchange function
499
512
  */
500
513
  onInputChange: PropTypes.func,
514
+ /**
515
+ * wrapper styles
516
+ */
517
+ customWrapperStyles: PropTypes.object,
518
+ /**
519
+ * label styles
520
+ */
521
+ customLabelStyles: PropTypes.object,
522
+ /**
523
+ * Mandatory or not
524
+ */
525
+ isRequired: PropTypes.bool,
526
+ /**
527
+ * default dropdown type
528
+ */
529
+ dropdownType: PropTypes.bool,
530
+ /**
531
+ * disabled or not
532
+ */
533
+ isDisabled: PropTypes.bool,
534
+ /**
535
+ * show loader or not
536
+ */
537
+ isLoading: PropTypes.bool,
538
+ /**
539
+ * valid or not
540
+ */
541
+ isValid: PropTypes.bool,
542
+ /**
543
+ * height of the component
544
+ */
545
+ height: PropTypes.number,
546
+ /**
547
+ * clearable or not
548
+ */
549
+ isClearable: PropTypes.bool,
550
+
501
551
  };
502
552
 
503
553
  DropdownSelect.defaultProps = {
@@ -514,4 +564,10 @@ DropdownSelect.defaultProps = {
514
564
  loadOptions: () => { },
515
565
  onInputChange: () => { },
516
566
  clearSelected: () => { },
567
+ customWrapperStyles: () => { },
568
+ customLabelStyles: () => { },
569
+ isRequired: false,
570
+ dropdownType: 'singleSelect',
571
+ isDisabled: false,
572
+ isLoading: false
517
573
  };
@@ -1,35 +1,39 @@
1
- import React, { useState, createRef } from 'react';
2
- import styled from 'styled-components';
3
- import defaultThemeColor from '../constants/defaultThemeColor';
4
1
  import PropTypes from 'prop-types';
2
+ import React, { createRef, useState } from 'react';
3
+ import styled, { useTheme } from 'styled-components';
5
4
  import defaultStyles from '../constants/defaultStyle';
6
- import getDefaultStyles from '../constants/utils';
7
- import { hexToRGB } from '../constants/utils';
5
+ import defaultThemeColor from '../constants/defaultThemeColor';
6
+ import getDefaultStyles, { hexToRGB } from '../constants/utils';
8
7
 
9
8
  import { Icon } from '../Icon';
10
9
  import { Label } from '../Label';
11
10
 
12
11
  const ParentDiv = styled.div`
13
12
  //Set the styles from the default styles object
14
- ${({ theme, defaultStyles }) => {
15
- return getDefaultStyles(theme, defaultStyles);
13
+ ${({ inBuiltCss, defaultStyles }) => {
14
+ return getDefaultStyles(inBuiltCss, defaultStyles);
16
15
  }}
17
16
 
18
- background-color:${({ hover, isValid, fileArr, backgroundColor }) =>
19
- !isValid
20
- ? 'rgba(215, 0, 0, 0.05)'
21
- : hover
22
- ? backgroundColor
23
- : fileArr.length > 0
24
- ? defaultThemeColor.bgColor
25
- : hexToRGB(backgroundColor, 0.05)};
17
+ background-color:${({ hover, isValid, fileArr, backgroundColor, theme }) => {
18
+ if (!isValid) return 'rgba(215, 0, 0, 0.05)';
19
+ else if (isValid && hover && backgroundColor) return backgroundColor;
20
+ else if (isValid && hover && !backgroundColor)
21
+ return theme.primary['primary-1'];
22
+ else if (isValid && !hover && fileArr.length > 0) return theme.bgColor;
23
+ else if (isValid && !hover && fileArr.length == 0)
24
+ return hexToRGB(theme.primary['primary-1'], 0.05);
25
+ }}
26
+
27
+ };
26
28
  border: 1px
27
- ${({ isValid, fileArr, backgroundColor }) =>
29
+ ${({ isValid, fileArr, backgroundColor, theme }) =>
28
30
  !isValid
29
- ? 'dashed ' + defaultThemeColor.ui['error']
31
+ ? 'dashed ' + theme.ui['error']
30
32
  : fileArr.length > 0
31
- ? 'solid ' + backgroundColor
32
- : 'dashed ' + backgroundColor};
33
+ ? `solid ` +
34
+ `${backgroundColor ? backgroundColor : theme.primary['primary-1']}`
35
+ : `dashed ` +
36
+ `${backgroundColor ? backgroundColor : theme.primary['primary-1']}`};
33
37
 
34
38
  &:hover {
35
39
  cursor: pointer;
@@ -42,8 +46,8 @@ const ParentDiv = styled.div`
42
46
 
43
47
  const FileDiv = styled.div`
44
48
  //Set the styles from the default styles object
45
- ${({ theme, defaultStyles }) => {
46
- return getDefaultStyles(theme, defaultStyles);
49
+ ${({ inBuiltCss, defaultStyles }) => {
50
+ return getDefaultStyles(inBuiltCss, defaultStyles);
47
51
  }}
48
52
 
49
53
  // custom styles
@@ -56,8 +60,8 @@ const InputFile = styled.input`
56
60
 
57
61
  const TextDiv = styled.div`
58
62
  //Set the styles from the default styles object
59
- ${({ theme, defaultStyles }) => {
60
- return getDefaultStyles(theme, defaultStyles);
63
+ ${({ inBuiltCss, defaultStyles }) => {
64
+ return getDefaultStyles(inBuiltCss, defaultStyles);
61
65
  }}
62
66
 
63
67
  // custom styles
@@ -66,8 +70,8 @@ const TextDiv = styled.div`
66
70
 
67
71
  const FileName = styled.span`
68
72
  //Set the styles from the default styles object
69
- ${({ theme, type }) => {
70
- return getDefaultStyles(theme, type);
73
+ ${({ inBuiltCss, type }) => {
74
+ return getDefaultStyles(inBuiltCss, type);
71
75
  }}
72
76
 
73
77
  // custom styles
@@ -86,8 +90,6 @@ const CrossDiv = styled.div`
86
90
  const IconDiv = styled.div`
87
91
  margin-left: 11px;
88
92
  padding-left: 2px;
89
- display: flex;
90
- justify-content: center;
91
93
  `;
92
94
 
93
95
  const OtherInfoDiv = styled.div`
@@ -106,8 +108,6 @@ const AdditionalText = styled.p`
106
108
  `;
107
109
 
108
110
  export const DropzoneInput = ({
109
- theme,
110
- themeColor,
111
111
  isValid,
112
112
  label,
113
113
  labelStyle,
@@ -127,6 +127,8 @@ export const DropzoneInput = ({
127
127
  additionalText,
128
128
  ...props
129
129
  }) => {
130
+ const activeTheme = useTheme() || defaultThemeColor;
131
+
130
132
  const [hover, setHover] = useState(false);
131
133
  const fileInputRef = createRef();
132
134
 
@@ -196,13 +198,11 @@ export const DropzoneInput = ({
196
198
  function openFileDialog() {
197
199
  fileInputRef.current.click();
198
200
  }
199
- return (
200
- <div
201
201
 
202
- >
202
+ return (
203
+ <div>
203
204
  <div style={{ display: 'flex', width: 'inherit' }}>
204
205
  <Label
205
- themeColor={defaultThemeColor}
206
206
  customStyles={labelStyle}
207
207
  type={'label-text'}
208
208
  labelInline={labelInline}
@@ -218,7 +218,7 @@ export const DropzoneInput = ({
218
218
  <div
219
219
  style={{
220
220
  marginLeft: '4px',
221
- color: `${themeColor.variant['error']}`,
221
+ color: `${activeTheme.variant['error']}`,
222
222
  }}
223
223
  >
224
224
  *
@@ -226,8 +226,8 @@ export const DropzoneInput = ({
226
226
  )}
227
227
  </div>
228
228
  <ParentDiv
229
- theme={defaultStyles}
230
- themeColor={defaultThemeColor}
229
+ theme={activeTheme}
230
+ inBuiltCss={defaultStyles}
231
231
  defaultStyles={'dropzone-parent'}
232
232
  backgroundColor={backgroundColor}
233
233
  customDropzoneStyles={customDropzoneStyles}
@@ -250,7 +250,9 @@ export const DropzoneInput = ({
250
250
  {isValid ? (
251
251
  <Icon
252
252
  icon='file-upload'
253
- color={hover ? themeColor.bgColor : backgroundColor}
253
+ color={
254
+ hover ? activeTheme.bgColor : activeTheme.primary['primary-1']
255
+ }
254
256
  size={24}
255
257
  />
256
258
  ) : null}
@@ -258,28 +260,32 @@ export const DropzoneInput = ({
258
260
  isValid={isValid}
259
261
  hover={hover}
260
262
  customTextStyles={customTextStyles}
261
- theme={defaultStyles}
263
+ inBuiltCss={defaultStyles}
262
264
  defaultStyles={'dropzone-text-div'}
263
265
  >
264
266
  {isValid ? (
265
267
  <div>
266
268
  <span
267
- style={{ color: hover ? themeColor.bgColor : backgroundColor }}
269
+ style={{
270
+ color: hover
271
+ ? activeTheme.bgColor
272
+ : activeTheme.primary['primary-1'],
273
+ }}
268
274
  >
269
275
  Choose a file{' '}
270
276
  </span>
271
277
  <span
272
278
  style={{
273
279
  color: hover
274
- ? themeColor.bgColor
275
- : themeColor.neutral['neutral-2'],
280
+ ? activeTheme.bgColor
281
+ : activeTheme.neutral['neutral-2'],
276
282
  }}
277
283
  >
278
284
  or{' '}
279
285
  </span>
280
286
  <span
281
287
  style={{
282
- color: hover ? themeColor.bgColor : themeColor.textColor,
288
+ color: hover ? activeTheme.bgColor : activeTheme.textColor,
283
289
  }}
284
290
  >
285
291
  drag {singleFile ? 'it' : 'them'} here
@@ -287,12 +293,12 @@ export const DropzoneInput = ({
287
293
  </div>
288
294
  ) : (
289
295
  <div>
290
- <span style={{ color: themeColor.variant['error'] }}>
296
+ <span style={{ color: activeTheme.variant['error'] }}>
291
297
  Try again!!{' '}
292
298
  </span>
293
299
  <span
294
300
  style={{
295
- color: theme.textColor,
301
+ color: activeTheme.textColor,
296
302
  }}
297
303
  >
298
304
  {message.length > messageSize
@@ -309,38 +315,54 @@ export const DropzoneInput = ({
309
315
  {fileArr?.map((item, i) => {
310
316
  return (
311
317
  <FileDiv
312
- theme={defaultStyles}
318
+ inBuiltCss={defaultStyles}
313
319
  defaultStyles={'dropzone-file-div'}
314
320
  key={`${item}-${i}`}
315
321
  customFileStyles={customFileStyles}
316
322
  >
317
323
  <IconDiv>
318
- <Icon icon='file-icon' />
324
+ <Icon icon='file-icon' color={activeTheme.primary['primary-1']} />
319
325
  </IconDiv>
320
326
 
321
- {!(item instanceof File) ? <a style={{ color: defaultThemeColor.variant['primary-1'], marginLeft: '5px' }} href={item?.path} target="_blank" rel="noreferrer"> {item.name}
322
- </a> : <FileName
323
- theme={defaultStyles}
324
- type={'dropzone-file-name'}
325
- customFileNameStyles={customFileNameStyles}
326
- >
327
- {item.name}
328
- </FileName>}
329
-
330
-
331
-
327
+ {!(item instanceof File) ? (
328
+ <a
329
+ style={{
330
+ color: activeTheme.variant['primary-1'],
331
+ marginLeft: '5px',
332
+ }}
333
+ href={item?.path}
334
+ target='_blank'
335
+ rel='noreferrer'
336
+ >
337
+ {' '}
338
+ {item.name}
339
+ </a>
340
+ ) : (
341
+ <FileName
342
+ inBuiltCss={defaultStyles}
343
+ type={'dropzone-file-name'}
344
+ customFileNameStyles={customFileNameStyles}
345
+ >
346
+ {item.name}
347
+ </FileName>
348
+ )}
332
349
 
333
350
  <OtherInfoDiv>{item?.otherInfo}</OtherInfoDiv>
334
- <IconDiv>
335
- <Icon icon={`${!(item instanceof File) && 'cloud-icon'}`} />
336
- </IconDiv>
351
+
337
352
  <CrossDiv
338
353
  key={(Math.random() * 101) | 0}
339
354
  onClick={() => fileRemoveFromArary(item, i)}
340
355
  >
356
+ <div style={{ marginRight: '7px' }}>
357
+ <Icon
358
+ icon={`${!(item instanceof File) && 'cloud-icon'}`}
359
+ color={activeTheme.primary['primary-1']}
360
+ />
361
+ </div>
362
+
341
363
  <Icon
342
364
  icon='cross-icon'
343
- color={themeColor.neutral['neutral-2']}
365
+ color={activeTheme.neutral['neutral-2']}
344
366
  size={13}
345
367
  />
346
368
  </CrossDiv>
@@ -352,10 +374,6 @@ export const DropzoneInput = ({
352
374
  };
353
375
 
354
376
  DropzoneInput.propTypes = {
355
- /**
356
- * Theme props of the default css style
357
- */
358
- theme: PropTypes.object,
359
377
  /**
360
378
  * onFileAdd function
361
379
  */
@@ -411,12 +429,9 @@ DropzoneInput.propTypes = {
411
429
  };
412
430
 
413
431
  DropzoneInput.defaultProps = {
414
- themeColor: defaultThemeColor,
415
- theme: defaultStyles,
416
432
  onFilesAdded: () => null,
417
433
  isValid: true,
418
434
  message: '',
419
- backgroundColor: `${defaultThemeColor.primary['primary-1']}`,
420
435
  fileArr: [],
421
436
  setFileArr: () => { },
422
437
  customDropzoneStyles: {},