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,12 +1,12 @@
1
- import React, { useState } from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import styled, { css, useTheme } from 'styled-components';
2
+ import React from 'react';
3
+ import styled, { css } from 'styled-components';
4
4
  import defaultThemeColor from '../constants/defaultThemeColor';
5
5
 
6
6
  const TextBox = styled.div`
7
7
  border: 1px solid
8
8
  ${({ theme }) =>
9
- theme ? defaultThemeColor.border : theme.variant['primary-1']};
9
+ theme.border};
10
10
  border-radius: 4px;
11
11
  padding: 6.5px 12px;
12
12
  display: flex;
@@ -27,7 +27,7 @@ const TextBox = styled.div`
27
27
  `;
28
28
 
29
29
  TextBox.defaultProps = {
30
- theme: defaultThemeColor,
30
+ theme: defaultThemeColor,
31
31
  };
32
32
 
33
33
  const Input = styled.input`
@@ -45,7 +45,7 @@ const Input = styled.input`
45
45
  `;
46
46
 
47
47
  Input.defaultProps = {
48
- theme: defaultThemeColor,
48
+ theme: defaultThemeColor,
49
49
  };
50
50
 
51
51
  const requiredAsterisk = css`
@@ -69,7 +69,7 @@ const Label = styled.label`
69
69
  `;
70
70
 
71
71
  Label.defaultProps = {
72
- theme: defaultThemeColor,
72
+ theme: defaultThemeColor,
73
73
  };
74
74
 
75
75
  const inline = css`
@@ -86,70 +86,73 @@ const Form = styled.div`
86
86
  `;
87
87
 
88
88
  Form.defaultProps = {
89
- theme: defaultThemeColor,
89
+ theme: defaultThemeColor,
90
90
  };
91
91
  export const NumericInput = ({
92
- label,
93
- inputValue,
94
- inputStyle,
95
- iconBefore,
96
- iconAfter,
97
- onChange,
98
- ...props
92
+ label,
93
+ inputValue,
94
+ inputStyle,
95
+ iconBefore,
96
+ iconAfter,
97
+ onChange,
98
+ theme,
99
+ ...props
99
100
  }) => {
100
- const handleChange = (e) => {
101
- const re = /^[0-9\b.-]+$/;
102
- const { value } = e.currentTarget;
103
- if (value === '' || re.test(value)) {
104
- onChange(value);
105
- }
106
- };
107
-
108
- return (
109
- <Form {...props}>
110
- {label.length > 0 && <Label {...props}>{label}</Label>}
111
- <div>
112
- <TextBox {...props}>
113
- <div className='input-icon'>{iconBefore}</div>
114
- <Input
115
- {...props}
116
- inputStyle={inputStyle}
117
- value={inputValue}
118
- onChange={handleChange}
119
- type='number'
120
- />
121
- <div className='input-icon'>{iconAfter}</div>
122
- </TextBox>
123
- </div>
124
- </Form>
125
- );
101
+ const handleChange = (e) => {
102
+ const re = /^[0-9\b.-]+$/;
103
+ const { value } = e.currentTarget;
104
+ if (value === '' || re.test(value)) {
105
+ onChange(value);
106
+ }
107
+ };
108
+
109
+ return (
110
+ <Form {...props}>
111
+ {label.length > 0 && <Label {...props}>{label}</Label>}
112
+ <div>
113
+ <TextBox {...props}>
114
+ <div className='input-icon'>{iconBefore}</div>
115
+ <Input
116
+ {...props}
117
+ inputStyle={inputStyle}
118
+ value={inputValue}
119
+ onChange={handleChange}
120
+ type='number'
121
+ />
122
+ <div className='input-icon'>{iconAfter}</div>
123
+ </TextBox>
124
+ </div>
125
+ </Form>
126
+ );
126
127
  };
127
128
 
128
129
  NumericInput.propTypes = {
129
- /**
130
- * Theme props
131
- */
132
- theme: PropTypes.object,
133
- /**
134
- * Label of Input
135
- */
136
- label: PropTypes.string,
137
- /**
138
- * Should label be inline?
139
- */
140
- labelInline: PropTypes.bool,
141
- /**
142
- * Value Prop
143
- */
144
- inputValue: PropTypes.any,
145
-
146
- inputStyle: PropTypes.object,
130
+ /**
131
+ * Theme props
132
+ */
133
+ theme: PropTypes.object,
134
+ /**
135
+ * Label of Input
136
+ */
137
+ label: PropTypes.string,
138
+ /**
139
+ * Should label be inline?
140
+ */
141
+ labelInline: PropTypes.bool,
142
+ /**
143
+ * Value Prop
144
+ */
145
+ inputValue: PropTypes.any,
146
+ /**
147
+ * custom style of input element
148
+ */
149
+ inputStyle: PropTypes.object,
147
150
  };
148
151
 
149
152
  NumericInput.defaultProps = {
150
- theme: defaultThemeColor,
151
- label: '',
152
- labelInline: false,
153
- inputStyle: {},
154
- inputValue: null,
153
+ theme: defaultThemeColor,
154
+ label: '',
155
+ labelInline: false,
156
+ inputStyle: {},
157
+ inputValue: null,
155
158
  };
@@ -1,37 +1,36 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
2
+ import React, { useState } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import defaultThemeColor from '../constants/defaultThemeColor';
5
4
  import defaultStyles from '../constants/defaultStyle';
5
+ import defaultThemeColor from '../constants/defaultThemeColor';
6
6
  import getDefaultStyles from '../constants/utils';
7
- import { Label } from '../Label';
8
7
  import { Icon } from '../Icon';
9
- import { useState } from 'react';
8
+ import { Label } from '../Label';
10
9
 
11
10
  const TextWrapper = styled.div`
12
11
  //Set the styles from the default styles object
13
- ${({ theme, defaultWrapperStyle }) => {
14
- return getDefaultStyles(theme, defaultWrapperStyle);
12
+ ${({ inBuiltCss, defaultWrapperStyle }) => {
13
+ return getDefaultStyles(inBuiltCss, defaultWrapperStyle);
15
14
  }}
16
15
 
17
- border: ${({ isValid, themeColor }) =>
16
+ border: ${({ isValid, theme }) =>
18
17
  !isValid
19
- ? '1px solid ' + themeColor.variant['error']
20
- : '1px solid ' + defaultThemeColor.border};
18
+ ? '1px solid ' + theme.variant['error']
19
+ : '1px solid ' + theme.border};
21
20
 
22
21
  .input-icon svg path {
23
- fill: ${({ themeColor }) => themeColor.variant['neutral-1']};
22
+ fill: ${({ theme }) => theme.variant['neutral-1']};
24
23
  }
25
24
  .input-icon {
26
25
  cursor: pointer;
27
26
  }
28
27
 
29
28
  &:focus-within {
30
- border: 1px solid ${({ themeColor }) => themeColor.variant['primary-1']};
29
+ border: 1px solid ${({ theme }) => theme.variant['primary-1']};
31
30
  outline: none;
32
31
 
33
32
  .input-icon svg path {
34
- fill: ${({ themeColor }) => themeColor.variant['primary-1']};
33
+ fill: ${({ theme }) => theme.variant['primary-1']};
35
34
  }
36
35
  }
37
36
 
@@ -39,24 +38,30 @@ const TextWrapper = styled.div`
39
38
  ${({ textBoxStyle }) => textBoxStyle}
40
39
  `;
41
40
 
41
+ TextWrapper.defaultProps = {
42
+ theme: defaultThemeColor,
43
+ };
44
+
42
45
  const Input = styled.input`
43
46
  width: inherit;
44
47
  -webkit-text-security: ${({ showEye }) => showEye ? 'none' : 'disc'} ;
45
48
 
46
49
  //Set the styles from the default styles object
47
- ${({ theme, defaultInputStyle }) => {
48
- return getDefaultStyles(theme, defaultInputStyle);
50
+ ${({ inBuiltCss, defaultInputStyle }) => {
51
+ return getDefaultStyles(inBuiltCss, defaultInputStyle);
49
52
  }}
50
53
 
51
54
  // custom styles
52
55
  ${({ inputStyle }) => inputStyle}
53
56
 
54
57
  .sc-furwcr bxRAoq {
55
- color: ${defaultThemeColor.variant['neutral-3']};
58
+ color: ${({ theme }) => theme.variant['neutral-3']};
56
59
  }
57
60
 
58
61
  `;
59
-
62
+ Input.defaultProps = {
63
+ theme: defaultThemeColor,
64
+ };
60
65
  const inline = css`
61
66
  display: flex;
62
67
  gap: 7px;
@@ -66,18 +71,19 @@ const inline = css`
66
71
  const Form = styled.div`
67
72
  ${({ labelInline }) => (labelInline ? inline : null)}
68
73
  .err-text {
69
- color: ${({ themeColor }) => themeColor.variant['error']};
74
+ color: ${({ theme }) => theme.variant['error']};
70
75
  margin-top: 5px;
71
76
  font-size: 10px;
72
77
  }
73
78
  `;
74
79
 
80
+
75
81
  Form.defaultProps = {
76
- themeColor: defaultThemeColor,
82
+ theme: defaultThemeColor,
77
83
  };
78
84
 
79
85
  export const PasswordInput = ({
80
- themeColor,
86
+ theme,
81
87
  passwordRules,
82
88
  textBoxStyle,
83
89
  labelStyle,
@@ -93,7 +99,8 @@ export const PasswordInput = ({
93
99
  const [showEye, setShowEye] = useState(false);
94
100
 
95
101
  return (
96
- <Form labelInline={labelInline} {...props}>
102
+ <Form labelInline={labelInline} inBuiltCss={defaultStyles} {...props}
103
+ >
97
104
  <div style={{ display: 'flex' }}>
98
105
  <Label
99
106
  customStyles={labelStyle}
@@ -112,7 +119,7 @@ export const PasswordInput = ({
112
119
  style={{
113
120
  marginLeft: '4px',
114
121
  marginRight: '5px',
115
- color: `${themeColor.variant['error']}`,
122
+ color: `${theme.variant['error']}`,
116
123
  }}
117
124
  >
118
125
  *
@@ -128,18 +135,20 @@ export const PasswordInput = ({
128
135
  >
129
136
  <TextWrapper
130
137
  required={required}
131
- themeColor={defaultThemeColor}
138
+ theme={theme}
132
139
  textBoxStyle={textBoxStyle}
133
140
  isValid={isValid}
134
- theme={defaultStyles}
135
141
  defaultWrapperStyle={'textbox-wrapper'}
142
+ inBuiltCss={defaultStyles}
136
143
  {...props}
137
144
  >
138
145
  <Input
139
146
  inputStyle={inputStyle}
140
147
  type={'text'}
141
148
  showEye={showEye}
149
+ theme={theme}
142
150
  defaultInputStyle={'input-wrapper'}
151
+ inBuiltCss={defaultStyles}
143
152
  {...props}
144
153
  />
145
154
  <div className='input-icon' onClick={() => setShowEye(!showEye)}>
@@ -157,11 +166,11 @@ PasswordInput.propTypes = {
157
166
  /**
158
167
  * Theme props of default in-built css
159
168
  */
160
- theme: PropTypes.object,
169
+ inBuiltCss: PropTypes.object,
161
170
  /**
162
171
  * Color props of default theme
163
172
  */
164
- themeColor: PropTypes.object,
173
+ theme: PropTypes.object,
165
174
  /**
166
175
  * Label of Input
167
176
  */
@@ -202,8 +211,8 @@ PasswordInput.propTypes = {
202
211
  };
203
212
 
204
213
  PasswordInput.defaultProps = {
205
- themeColor: defaultThemeColor,
206
- theme: defaultStyles,
214
+ theme: defaultThemeColor,
215
+ inBuiltCss: defaultStyles,
207
216
  label: '',
208
217
  required: false,
209
218
  isValid: true,
@@ -1,8 +1,7 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
- import defaultThemeColor from '../constants/defaultThemeColor';
2
+ import styled, { useTheme } from 'styled-components';
5
3
  import defaultStyles from '../constants/defaultStyle';
4
+ import defaultThemeColor from '../constants/defaultThemeColor';
6
5
  import getDefaultStyles from '../constants/utils';
7
6
  import { Label } from '../Label';
8
7
 
@@ -10,8 +9,8 @@ const RadioOuterCircle = styled.div`
10
9
  box-sizing: initial;
11
10
 
12
11
  //Set the styles from the default styles object
13
- ${({ theme, defaultRadioOuterCircleStyle }) => {
14
- return getDefaultStyles(theme, defaultRadioOuterCircleStyle);
12
+ ${({ inBuiltCss, defaultRadioOuterCircleStyle }) => {
13
+ return getDefaultStyles(inBuiltCss, defaultRadioOuterCircleStyle);
15
14
  }}
16
15
 
17
16
  border: 2px solid ${({
@@ -19,41 +18,74 @@ const RadioOuterCircle = styled.div`
19
18
  selected,
20
19
  selectedCircleColor,
21
20
  defaultBorderColor,
22
- }) => (value !== selected ? defaultBorderColor : selectedCircleColor)};
21
+ theme,
22
+ }) => {
23
+ if (value !== selected && defaultBorderColor) return defaultBorderColor;
24
+ else if (value !== selected && !defaultBorderColor) return theme.border;
25
+ else if (value === selected && selectedCircleColor)
26
+ return selectedCircleColor;
27
+ else if (value === selected && !selectedCircleColor)
28
+ return theme.primary['primary-1'];
29
+ }};
23
30
 
24
31
  // custom styles
25
32
  ${({ radioOuterCircleStyle }) => radioOuterCircleStyle}
26
33
  `;
27
34
 
35
+ RadioOuterCircle.defaultProps = {
36
+ theme: defaultThemeColor,
37
+ };
38
+
28
39
  const RadioInnerCircle = styled.div`
29
40
  box-sizing: initial;
30
41
 
31
42
  //Set the styles from the default styles object
32
- ${({ theme, defaultRadioInnerCircleStyle }) => {
33
- return getDefaultStyles(theme, defaultRadioInnerCircleStyle);
43
+ ${({ inBuiltCss, defaultRadioInnerCircleStyle }) => {
44
+ return getDefaultStyles(inBuiltCss, defaultRadioInnerCircleStyle);
34
45
  }}
35
46
 
36
47
  width: ${({ value, selected, width }) => (value === selected ? width : 0)};
37
48
  height: ${({ value, selected, height }) => (value === selected ? height : 0)};
38
- background-color: ${({ value, selected, selectedCircleColor }) =>
39
- value === selected ? selectedCircleColor : 'transparent'};
49
+ background-color: ${({ value, selected, selectedCircleColor, theme }) => {
50
+ if (value === selected && selectedCircleColor) return selectedCircleColor;
51
+ else if (value === selected && !selectedCircleColor)
52
+ return theme.primary['primary-1'];
53
+ else if (value !== selected) return 'transparent';
54
+ }};
40
55
 
41
56
  // custom styles
42
57
  ${({ radioInnerCircleStyle }) => radioInnerCircleStyle}
43
58
  `;
59
+ RadioInnerCircle.defaultProps = {
60
+ theme: defaultThemeColor,
61
+ };
44
62
 
45
63
  const OptionText = styled.div`
46
64
  //Set the styles from the default styles object
47
- ${({ theme, defaultOptionStyle }) => {
48
- return getDefaultStyles(theme, defaultOptionStyle);
65
+ ${({ inBuiltCss, defaultOptionStyle }) => {
66
+ return getDefaultStyles(inBuiltCss, defaultOptionStyle);
49
67
  }}
50
68
  margin-right: ${({ inline }) => (!inline ? '30px' : '')};
51
- color: ${({ selected, selectedOptionTextColor, defaultOptionColor }) =>
52
- selected ? selectedOptionTextColor : defaultOptionColor};
69
+ color: ${({
70
+ selected,
71
+ selectedOptionTextColor,
72
+ defaultOptionColor,
73
+ theme,
74
+ }) => {
75
+ if (selected && selectedOptionTextColor) return selectedOptionTextColor;
76
+ else if (selected && !selectedOptionTextColor)
77
+ return theme.neutral['neutral-1'];
78
+ else if (!selected && defaultOptionColor) return defaultOptionColor;
79
+ else if (!selected && !defaultOptionColor)
80
+ return theme.neutral['neutral-2'];
81
+ }};
53
82
 
54
83
  // custom styles
55
84
  ${({ optionStyle }) => optionStyle}
56
85
  `;
86
+ OptionText.defaultProps = {
87
+ theme: defaultThemeColor,
88
+ };
57
89
 
58
90
  const WrapperDiv = styled.div`
59
91
  margin-bottom: ${({ inline }) => (!inline ? '14px' : '')};
@@ -87,14 +119,11 @@ export const RadioInput = ({
87
119
  defaultOptionColor,
88
120
  ...props
89
121
  }) => {
122
+ const activeTheme = useTheme() || defaultThemeColor;
123
+
90
124
  return (
91
125
  <div>
92
- <Label
93
- themeColor={defaultThemeColor}
94
- customStyles={labelStyle}
95
- type={'radio-label'}
96
- text={label}
97
- />
126
+ <Label customStyles={labelStyle} type={'radio-label'} text={label} />
98
127
  <ParentDiv inline={inline}>
99
128
  {options.map((item, i) => {
100
129
  return (
@@ -106,8 +135,8 @@ export const RadioInput = ({
106
135
  }}
107
136
  >
108
137
  <RadioOuterCircle
109
- theme={defaultStyles}
110
- themeColor={defaultThemeColor}
138
+ theme={activeTheme}
139
+ inBuiltCss={defaultStyles}
111
140
  defaultBorderColor={defaultBorderColor}
112
141
  selectedCircleColor={selectedCircleColor}
113
142
  radioOuterCircleStyle={{
@@ -120,7 +149,8 @@ export const RadioInput = ({
120
149
  selected={!item?.disabled && selected}
121
150
  >
122
151
  <RadioInnerCircle
123
- theme={defaultStyles}
152
+ inBuiltCss={defaultStyles}
153
+ theme={activeTheme}
124
154
  width={width}
125
155
  height={height}
126
156
  selectedCircleColor={selectedCircleColor}
@@ -145,10 +175,10 @@ export const RadioInput = ({
145
175
  cursor: item?.disabled ? 'not-allowed ' : ' pointer',
146
176
  color: item?.disabled && item?.disabledColor,
147
177
  }}
148
- theme={defaultStyles}
178
+ inBuiltCss={defaultStyles}
149
179
  defaultOptionStyle={'option-text'}
150
180
  selectedOptionTextColor={selectedOptionTextColor}
151
- // selected={item.value === selected}
181
+ theme={activeTheme}
152
182
  selected={!item?.disabled && item.value === selected}
153
183
  >
154
184
  {item.label}
@@ -237,10 +267,6 @@ RadioInput.defaultProps = {
237
267
  onChange: () => { },
238
268
  radioOuterCircleStyle: {},
239
269
  radioInnerCircleStyle: {},
240
- defaultOptionColor: `${defaultThemeColor.neutral['neutral-2']}`,
241
- defaultBorderColor: '#D4D7E3',
242
270
  width: '14px',
243
271
  height: '14px',
244
- selectedCircleColor: `${defaultThemeColor.primary['primary-1']}`,
245
- selectedOptionTextColor: `${defaultThemeColor.neutral['neutral-1']}`,
246
272
  };