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,5 +1,5 @@
1
- import React from 'react';
2
1
  import PropTypes from 'prop-types';
2
+ import React from 'react';
3
3
  import styled, { css, useTheme } from 'styled-components';
4
4
  import defaultThemeColor from '../constants/defaultThemeColor';
5
5
 
@@ -8,7 +8,7 @@ const TextBox = styled.div`
8
8
  font-size: 21px;
9
9
  border: 1px solid
10
10
  ${({ theme, isValid }) =>
11
- isValid ? defaultThemeColor.border : theme.variant['error']};
11
+ isValid ? defaultThemeColor.border : theme.variant['error']};
12
12
  border-radius: 4px;
13
13
  padding: 5px;
14
14
  display: inline-block;
@@ -20,10 +20,6 @@ const TextBox = styled.div`
20
20
  }
21
21
  `;
22
22
 
23
- TextBox.defaultProps = {
24
- theme: defaultThemeColor,
25
- };
26
-
27
23
  const Input = styled.input`
28
24
  border: 0;
29
25
  outline: 0;
@@ -32,12 +28,10 @@ const Input = styled.input`
32
28
  padding: 0;
33
29
  font-size: 21px;
34
30
  width: 24px;
31
+ text-align:center;
35
32
  background-color: ${({ theme }) => theme.bgColor};
36
33
  `;
37
34
 
38
- Input.defaultProps = {
39
- theme: defaultThemeColor,
40
- };
41
35
 
42
36
  const requiredAsterisk = css`
43
37
  &:after {
@@ -49,16 +43,14 @@ const requiredAsterisk = css`
49
43
  const Label = styled.label`
50
44
  display: block;
51
45
  margin-bottom: ${({ labelInline, errMsg }) =>
52
- labelInline && errMsg ? '18px' : '7px'};
46
+ labelInline && errMsg ? '18px' : '7px'};
53
47
  margin-right: ${({ labelInline }) => (labelInline ? '7px' : '')};
54
48
  color: ${({ theme }) => theme.variant['neutral-2']};
55
49
  ${({ required }) => (required ? requiredAsterisk : null)}
56
50
  padding-bottom: 0px;
57
51
  `;
58
52
 
59
- Label.defaultProps = {
60
- theme: defaultThemeColor,
61
- };
53
+
62
54
 
63
55
  const inline = css`
64
56
  display: flex;
@@ -78,9 +70,6 @@ const Form = styled.div`
78
70
  }
79
71
  `;
80
72
 
81
- Form.defaultProps = {
82
- theme: defaultThemeColor,
83
- };
84
73
 
85
74
  const Button = styled.button`
86
75
  border: none;
@@ -93,103 +82,99 @@ const Button = styled.button`
93
82
  cursor: pointer;
94
83
  `;
95
84
 
96
- Button.defaultProps = {
97
- theme: defaultThemeColor,
98
- };
99
-
100
85
  export const TimeInput = ({
101
- label,
102
- errMsg,
103
- hour,
104
- minute,
105
- period,
106
- onChange,
107
- ...props
86
+ label,
87
+ errMsg,
88
+ hour,
89
+ minute,
90
+ period,
91
+ onChange,
92
+ ...props
108
93
  }) => {
109
- const theme = useTheme() || defaultThemeColor;
110
-
111
- function hourChange(evt) {
112
- const num =
113
- evt.currentTarget.value > 12
114
- ? 12
115
- : parseFloat(evt.currentTarget.value) || 0;
116
- onChange({ hour: num, minute, period });
117
- }
118
-
119
- function minuteChange(evt) {
120
- console.log('minute change', evt.currentTarget.value);
121
- const num =
122
- evt.currentTarget.value > 59
123
- ? 59
124
- : parseFloat(evt.currentTarget.value) || 0;
125
- onChange({ hour, minute: num, period });
126
- }
127
-
128
- function periodChange(evt) {
129
- const p = period === 'AM' ? 'PM' : 'AM';
130
- onChange({ hour, minute, period: p });
131
- }
132
-
133
- return (
134
- <Form {...props}>
135
- <Label {...props} errMsg={errMsg}>
136
- {label}
137
- </Label>
138
- <div>
139
- <TextBox {...props}>
140
- <Input value={hour} onChange={hourChange} />
141
- :
142
- <Input value={minute} onChange={minuteChange} />
143
- <Button onClick={periodChange}>{period}</Button>
144
- </TextBox>
145
- <div className='err-text'>{errMsg}</div>
146
- </div>
147
- </Form>
148
- );
94
+ const activeTheme = useTheme() || defaultThemeColor;
95
+
96
+ function hourChange(evt) {
97
+ const num =
98
+ evt.currentTarget.value > 12
99
+ ? 12
100
+ : parseFloat(evt.currentTarget.value) || 0;
101
+ onChange({ hour: num, minute, period });
102
+ }
103
+
104
+ function minuteChange(evt) {
105
+ console.log('minute change', evt.currentTarget.value);
106
+ const num =
107
+ evt.currentTarget.value > 59
108
+ ? 59
109
+ : parseFloat(evt.currentTarget.value) || 0;
110
+ onChange({ hour, minute: num, period });
111
+ }
112
+
113
+ function periodChange(evt) {
114
+ const p = period === 'AM' ? 'PM' : 'AM';
115
+ onChange({ hour, minute, period: p });
116
+ }
117
+
118
+ return (
119
+ <Form theme={activeTheme} {...props}>
120
+ <Label theme={activeTheme} {...props} errMsg={errMsg}>
121
+ {label}
122
+ </Label>
123
+ <div>
124
+ <TextBox theme={activeTheme} {...props}>
125
+ <Input theme={activeTheme} value={hour} onChange={hourChange} />
126
+ :
127
+ <Input theme={activeTheme} value={minute} onChange={minuteChange} />
128
+ <Button theme={activeTheme} onClick={periodChange}>{period}</Button>
129
+ </TextBox>
130
+ <div className='err-text'>{errMsg}</div>
131
+ </div>
132
+ </Form>
133
+ );
149
134
  };
150
135
 
151
136
  TimeInput.propTypes = {
152
- /**
153
- * Label of Input
154
- */
155
- label: PropTypes.string,
156
- /**
157
- * Hour value
158
- */
159
- hour: PropTypes.number.isRequired,
160
- /**
161
- * Minute value
162
- */
163
- minute: PropTypes.number.isRequired,
164
- /**
165
- * AM or PM ?
166
- */
167
- period: PropTypes.string.isRequired,
168
- /**
169
- * Is the input required?
170
- */
171
- required: PropTypes.bool,
172
- /**
173
- * Should label be inline?
174
- */
175
- labelInline: PropTypes.bool,
176
- /**
177
- * Is the input correct?
178
- */
179
- isValid: PropTypes.bool,
180
- /**
181
- * Error Message
182
- */
183
- errMsg: PropTypes.string,
137
+ /**
138
+ * Label of Input
139
+ */
140
+ label: PropTypes.string,
141
+ /**
142
+ * Hour value
143
+ */
144
+ hour: PropTypes.number.isRequired,
145
+ /**
146
+ * Minute value
147
+ */
148
+ minute: PropTypes.number.isRequired,
149
+ /**
150
+ * AM or PM ?
151
+ */
152
+ period: PropTypes.string.isRequired,
153
+ /**
154
+ * Is the input required?
155
+ */
156
+ required: PropTypes.bool,
157
+ /**
158
+ * Should label be inline?
159
+ */
160
+ labelInline: PropTypes.bool,
161
+ /**
162
+ * Is the input correct?
163
+ */
164
+ isValid: PropTypes.bool,
165
+ /**
166
+ * Error Message
167
+ */
168
+ errMsg: PropTypes.string,
184
169
  };
185
170
 
186
171
  TimeInput.defaultProps = {
187
- label: '',
188
- hour: 0,
189
- minute: 0,
190
- period: 'AM',
191
- required: false,
192
- labelInline: false,
193
- isValid: true,
194
- errMsg: '',
172
+ label: '',
173
+ hour: 0,
174
+ minute: 0,
175
+ period: 'AM',
176
+ required: false,
177
+ labelInline: false,
178
+ isValid: true,
179
+ errMsg: '',
195
180
  };
@@ -1,85 +1,116 @@
1
- import React from "react";
2
- import styled from "styled-components";
3
1
  import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import styled, { useTheme } from 'styled-components';
4
4
  import defaultStyles from '../constants/defaultStyle';
5
- import getDefaultStyles from '../constants/utils';
6
5
  import defaultThemeColor from '../constants/defaultThemeColor';
6
+ import getDefaultStyles from '../constants/utils';
7
7
 
8
8
  const CheckBoxWrapper = styled.div`
9
- ${({ theme, defaultCheckBoxWrapperStyle }) => {
10
- return getDefaultStyles(theme, defaultCheckBoxWrapperStyle);
9
+ ${({ inBuiltCss, defaultCheckBoxWrapperStyle }) => {
10
+ return getDefaultStyles(inBuiltCss, defaultCheckBoxWrapperStyle);
11
11
  }}
12
12
  `;
13
13
  const CheckBoxLabel = styled.label`
14
- //Set the styles from the default styles object
15
- ${({ theme, defaultCheckBoxLabelStyle }) => {
16
- return getDefaultStyles(theme, defaultCheckBoxLabelStyle);
14
+ //Set the styles from the default styles object
15
+ ${({ inBuiltCss, defaultCheckBoxLabelStyle }) => {
16
+ return getDefaultStyles(inBuiltCss, defaultCheckBoxLabelStyle);
17
17
  }}
18
- background-color: ${({ checked, backgroundColor, disabledColor }) => checked ?
19
- backgroundColor : disabledColor};
18
+ background-color: ${({ checked, backgroundColor, disabledColor, theme }) => {
19
+ if (checked && backgroundColor) return backgroundColor;
20
+ else if (checked && !backgroundColor) return theme.primary['primary-1'];
21
+ else if (!checked && disabledColor) return disabledColor;
22
+ else if (!checked && !disabledColor) return theme.neutral['neutral-2'];
23
+ }};
24
+ // custom styles
25
+ ${({ customToggleBoxStyle }) => customToggleBoxStyle}
26
+ &:before {
27
+ content: '';
28
+ display: block;
29
+ border-radius: 50%;
30
+ width: 16px;
31
+ height: 16px;
32
+ margin-top: 3px;
33
+ background: ${({ switchColor, theme }) =>
34
+ switchColor ? switchColor : theme.bgColor};
35
+ transition: 0.2s;
36
+ margin-left: ${({ checked }) => (checked ? '4px' : '25px')};
37
+
20
38
  // custom styles
21
- ${({ customToggleBoxStyle }) => customToggleBoxStyle}
22
- &:before {
23
- content: "";
24
- display: block;
25
- border-radius: 50%;
26
- width: 16px;
27
- height: 16px;
28
- margin-top: 3px;
29
- background: ${({ switchColor }) => switchColor};
30
- transition: 0.2s;
31
- margin-left: ${({ checked }) => checked ? '4px' : '25px'};
32
-
33
- // custom styles
34
- ${({ customSwitchStyle }) => customSwitchStyle}
35
- }
39
+ ${({ customSwitchStyle }) => customSwitchStyle}
40
+ }
36
41
  `;
37
42
 
38
-
39
-
40
- const CheckBox = styled.input.attrs({ type: "checkbox" })`
41
- opacity: 0;
42
- z-index: 1;
43
- border-radius: 31px;
44
- width: 45px;
45
- height: 22px;
46
- cursor: pointer;
43
+ const CheckBox = styled.input.attrs({ type: 'checkbox' })`
44
+ opacity: 0;
45
+ z-index: 1;
46
+ border-radius: 31px;
47
+ width: 45px;
48
+ height: 22px;
49
+ cursor: pointer;
47
50
  `;
48
51
 
49
52
  const OptionText = styled.span`
50
- //Set the styles from the default styles object
51
- ${({ theme, defaultOptionTextStyle }) => {
52
- return getDefaultStyles(theme, defaultOptionTextStyle);
53
+ //Set the styles from the default styles object
54
+ ${({ inBuiltCss, defaultOptionTextStyle }) => {
55
+ return getDefaultStyles(inBuiltCss, defaultOptionTextStyle);
53
56
  }}
54
-
55
- // custom styles
57
+
58
+ // custom styles
56
59
  ${({ optionStyle }) => optionStyle}
57
60
  `;
58
61
 
59
- export const ToggleSwitch = ({ checked, customSwitchStyle, customToggleBoxStyle, backgroundColor, disabledColor, switchColor, onClick, trueLabel, falseLabel, optionStyle, ...props }) => {
62
+ export const ToggleSwitch = ({
63
+ checked,
64
+ customSwitchStyle,
65
+ customToggleBoxStyle,
66
+ backgroundColor,
67
+ disabledColor,
68
+ switchColor,
69
+ onClick,
70
+ trueLabel,
71
+ falseLabel,
72
+ optionStyle,
73
+ ...props
74
+ }) => {
75
+ const activeTheme = useTheme() || defaultThemeColor;
76
+
60
77
  return (
61
- <CheckBoxWrapper theme={defaultStyles} defaultCheckBoxWrapperStyle={'toggle-switch-wrapper'} {...props} >
62
- <CheckBox {...props}
63
- id="checkbox"
64
- theme={defaultStyles}
78
+ <CheckBoxWrapper
79
+ inBuiltCss={defaultStyles}
80
+ defaultCheckBoxWrapperStyle={'toggle-switch-wrapper'}
81
+ {...props}
82
+ >
83
+ <CheckBox
84
+ {...props}
85
+ id='checkbox'
86
+ inBuiltCss={defaultStyles}
65
87
  defaultCheckBoxStyle={'toggle-switch-checkbox'}
66
- onClick={() => { onClick(!checked) }}
88
+ onClick={() => {
89
+ onClick(!checked);
90
+ }}
67
91
  isChecked={checked}
68
92
  />
69
- <CheckBoxLabel {...props}
70
- htmlFor="checkbox"
93
+ <CheckBoxLabel
94
+ {...props}
95
+ htmlFor='checkbox'
71
96
  customToggleBoxStyle={customToggleBoxStyle}
72
97
  customSwitchStyle={customSwitchStyle}
73
98
  disabledColor={disabledColor}
74
99
  backgroundColor={backgroundColor}
75
100
  switchColor={switchColor}
76
- theme={defaultStyles}
101
+ inBuiltCss={defaultStyles}
77
102
  defaultCheckBoxLabelStyle={'toggle-switch-checkbox-label'}
78
103
  checked={checked}
104
+ theme={activeTheme}
79
105
  />
80
- <OptionText optionStyle={optionStyle}
81
- theme={defaultStyles}
82
- defaultOptionTextStyle={'toggle-switch-option-text'} {...props} >{checked ? trueLabel : falseLabel}</OptionText>
106
+ <OptionText
107
+ optionStyle={optionStyle}
108
+ inBuiltCss={defaultStyles}
109
+ defaultOptionTextStyle={'toggle-switch-option-text'}
110
+ {...props}
111
+ >
112
+ {checked ? trueLabel : falseLabel}
113
+ </OptionText>
83
114
  </CheckBoxWrapper>
84
115
  );
85
116
  };
@@ -103,21 +134,18 @@ ToggleSwitch.propTypes = {
103
134
  checked: PropTypes.bool,
104
135
  /**
105
136
  * label when toggle state is checked
106
- * */
137
+ * */
107
138
  trueLabel: PropTypes.string,
108
139
  /**
109
140
  * label when toggle state is not checked
110
- * */
141
+ * */
111
142
  falseLabel: PropTypes.string,
112
- }
143
+ };
113
144
 
114
145
  ToggleSwitch.defaultProps = {
115
- backgroundColor: `${defaultThemeColor.primary['primary-1']}`,
116
- switchColor: `${defaultThemeColor.bgColor}`,
117
- disabledColor: `${defaultThemeColor.neutral['neutral-2']}`,
118
146
  checked: false,
119
147
  trueLabel: 'Yes',
120
148
  falseLabel: 'No',
121
149
  customSwitchStyle: {},
122
- customToggleBoxStyle: {}
123
- }
150
+ customToggleBoxStyle: {},
151
+ };
@@ -1,11 +1,11 @@
1
+ import PropTypes from 'prop-types';
1
2
  import React from 'react';
2
3
  import Modal from 'react-modal';
3
- import styled from 'styled-components';
4
+ import styled, { useTheme } from 'styled-components';
4
5
  import defaultStyles from '../constants/defaultStyle';
6
+ import defaultThemeColor from '../constants/defaultThemeColor';
5
7
  import getDefaultStyles from '../constants/utils';
6
- import PropTypes from 'prop-types';
7
8
  import { Icon } from '../Icon';
8
- import defaultThemeColor from '../constants/defaultThemeColor';
9
9
 
10
10
  const customStyles = {
11
11
  overlay: {
@@ -21,8 +21,9 @@ const customStyles = {
21
21
  marginRight: '-50%',
22
22
  padding: '0px',
23
23
  transform: 'translate(-50%, -50%)',
24
- maxHeight: '75vh',
25
24
  minWidth: '40vw',
25
+ maxHeight: '85vh',
26
+ overflow: 'hidden',
26
27
  },
27
28
  };
28
29
 
@@ -56,6 +57,7 @@ const ModalHeader = styled.div`
56
57
  ${({ customModalHeaderStyle }) => customModalHeaderStyle}
57
58
  `;
58
59
  const ModalBody = styled.div`
60
+
59
61
  //Set the styles from the default styles object
60
62
  ${({ theme, type }) => {
61
63
  return getDefaultStyles(theme, type);
@@ -64,6 +66,11 @@ const ModalBody = styled.div`
64
66
  ${({ customModalBodyStyle }) => customModalBodyStyle}
65
67
  `;
66
68
 
69
+ const ContentWrapper = styled.div`
70
+ max-height: 60vh;
71
+ overflow-y: scroll;
72
+ `
73
+
67
74
  const ModalFooter = styled.div`
68
75
  //Set the styles from the default styles object
69
76
  ${({ theme, type }) => {
@@ -74,10 +81,26 @@ const ModalFooter = styled.div`
74
81
  `;
75
82
 
76
83
  const CommonDiv = styled.div`
77
- padding: 2rem 3rem 0rem 3rem;
84
+ padding: .5rem 3rem 0rem 3rem;
78
85
  `;
79
86
 
80
- Modal.setAppElement(window.next?.version ? "#__next" : '#root')
87
+ const HeaderWrapper = styled.div`
88
+ position: sticky;
89
+ background-color: ${({ theme }) => theme.bgColor};
90
+ width: 100%;
91
+ top: 0px;
92
+ border-bottom: 1px solid ${({ theme }) => theme.border}
93
+
94
+ `
95
+
96
+
97
+ try {
98
+ Modal.setAppElement('#root')
99
+
100
+ } catch (error) {
101
+ Modal.setAppElement('#__next')
102
+ }
103
+
81
104
 
82
105
  export const ModalComp = ({
83
106
  modalIsOpen,
@@ -92,6 +115,8 @@ export const ModalComp = ({
92
115
  customModalFooterStyle,
93
116
  ...props
94
117
  }) => {
118
+ const activeTheme = useTheme() || defaultThemeColor;
119
+
95
120
  return (
96
121
  <Modal
97
122
  isOpen={modalIsOpen}
@@ -100,38 +125,42 @@ export const ModalComp = ({
100
125
  contentLabel='Modal'
101
126
  {...props}
102
127
  >
103
- <ModalClose
104
- theme={defaultStyles}
105
- type={'modalComp-modal-close'}
106
- style={customModalCloseStyle}
107
- onClick={toggleModal}
108
- >
109
- <Icon
110
- icon='cross-icon'
111
- color={defaultThemeColor.neutral['neutral-2']}
112
- size={15}
113
- />
114
- </ModalClose>
115
-
116
- <ModalHeader style={customModalHeaderStyle}>
117
- <CommonDiv>{headerContent}</CommonDiv>
118
- </ModalHeader>
119
- <ModalBody
120
- theme={defaultStyles}
121
- type={'modalComp-modal-body'}
122
- style={customModalBodyStyle}
123
- >
124
- <CommonDiv> {bodyContent}
125
- </CommonDiv>
126
- </ModalBody>
127
-
128
- <ModalFooter
129
- theme={defaultStyles}
130
- type={'modalComp-modal-footer'}
131
- style={customModalFooterStyle}
132
- >
133
- {footerContent}
134
- </ModalFooter>
128
+ <HeaderWrapper theme={activeTheme}>
129
+ <ModalClose
130
+ theme={defaultStyles}
131
+ type={'modalComp-modal-close'}
132
+ style={customModalCloseStyle}
133
+ onClick={toggleModal}
134
+ >
135
+ <Icon
136
+ icon='cross-icon'
137
+ color={defaultThemeColor.neutral['neutral-2']}
138
+ size={15}
139
+ />
140
+ </ModalClose>
141
+
142
+ <ModalHeader style={customModalHeaderStyle}>
143
+ <CommonDiv>{headerContent}</CommonDiv>
144
+ </ModalHeader>
145
+ </HeaderWrapper>
146
+ <ContentWrapper>
147
+ <ModalBody
148
+ theme={defaultStyles}
149
+ type={'modalComp-modal-body'}
150
+ style={customModalBodyStyle}
151
+ >
152
+ <CommonDiv> {bodyContent}
153
+ </CommonDiv>
154
+ </ModalBody>
155
+
156
+ <ModalFooter
157
+ theme={defaultStyles}
158
+ type={'modalComp-modal-footer'}
159
+ style={customModalFooterStyle}
160
+ >
161
+ {footerContent}
162
+ </ModalFooter>
163
+ </ContentWrapper>
135
164
  </Modal>
136
165
  );
137
166
  };