groundfloor-react-ui 1.0.0 → 1.0.3

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 (34) hide show
  1. package/README.md +9 -2
  2. package/assets/icons/eye-hide.svg +1 -1
  3. package/assets/icons/file-upload.svg +3 -0
  4. package/components/Accordion/Accordion.js +2 -2
  5. package/components/Button/PrimaryButton.js +4 -7
  6. package/components/Button/SecondaryButton.js +7 -8
  7. package/components/Footer/{FooterContentLev3.js → FooterContent.js} +6 -2
  8. package/components/Footer/index.js +1 -1
  9. package/components/Form/FormComponent.js +5 -2
  10. package/components/Form/HeaderComponent.js +1 -6
  11. package/components/Icon/Icon.js +16 -6
  12. package/components/Inputs/CheckBoxInput.js +1 -1
  13. package/components/Inputs/DateSelect.js +3 -4
  14. package/components/Inputs/DropdownSelect.js +292 -289
  15. package/components/Inputs/DropzoneInput.js +225 -137
  16. package/components/Inputs/NumericInput.js +6 -11
  17. package/components/Inputs/PasswordInput.js +192 -0
  18. package/components/Inputs/Signature.js +142 -109
  19. package/components/Inputs/TextArea.js +3 -4
  20. package/components/Inputs/TextInput.js +6 -7
  21. package/components/Inputs/TimeInput.js +5 -6
  22. package/components/Inputs/index.js +1 -0
  23. package/components/Modal/ModalComp.js +80 -46
  24. package/components/Modal/index.js +0 -1
  25. package/components/constants/defaultStyle.js +28 -33
  26. package/components/constants/defaultThemeColor.js +2 -1
  27. package/dist/index.es.js +538 -493
  28. package/dist/index.js +388 -343
  29. package/package.json +1 -1
  30. package/components/Inputs/CheckBoxEditableInput.js +0 -352
  31. package/components/Inputs/CheckBoxInputMS.js +0 -160
  32. package/components/Inputs/TextInputClicable.js +0 -198
  33. package/components/Inputs/TextInputClicableMS.js +0 -255
  34. package/components/Modal/Modal.js +0 -116
@@ -1,255 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import PropTypes from 'prop-types';
3
- import styled, { css, useTheme } from 'styled-components';
4
- import defaultThemeColor from '../../constants/defaultThemeColor';
5
-
6
- const border = `#D4D7E3`;
7
-
8
- const TextBox = styled.div`
9
- border: 1px solid ${({ theme, isValid }) => isValid ? border : theme.variant['error']};
10
- border-radius: 4px;
11
- display: flex;
12
- align-items: center;
13
- position: relative;
14
- z-index: 2;
15
- cursor: pointer;
16
-
17
-
18
-
19
- .input-icon svg path {
20
- fill: ${({ theme }) => theme.variant['primary-2']};
21
- }
22
-
23
- &:focus-within {
24
- border: 1px solid ${({ theme }) => theme.variant['primary-1']};
25
- outline: none;
26
-
27
- .input-icon svg path {
28
- fill: ${({ theme, iconVariant }) => theme.variant[iconVariant]};
29
- }
30
- }
31
- `;
32
-
33
- const InputBorder = styled.div`
34
- position: absolute;
35
- top: calc(100% - 3px);
36
- bottom: -2px;
37
- left: 0;
38
- right: 0;
39
- z-index: 0;
40
- border: 1px solid ${border};
41
- border-top: none;
42
- border-bottom: none;
43
- visibility: ${({ menuIsOpen }) => menuIsOpen ? 'visible' : 'hidden'}
44
- `
45
-
46
-
47
- const Input = styled.input`
48
- border: 0;
49
- outline: 0;
50
- color: ${({ theme }) => theme.variant['primary-2']};
51
- margin: 0 5px;
52
- padding: 8px 0 8px 12px;
53
- font-size: 14px;
54
- flex-grow: 1;
55
- flex-shrink: 0;
56
- cursor: ${({ isSearchable, menuIsOpen }) => !isSearchable ? 'pointer' : menuIsOpen ? 'input' : 'pointer'};
57
- white-space: nowrap;
58
- overflow: hidden;
59
- text-overflow: ellipsis;
60
-
61
- ::placeholder {
62
- color: ${({ theme, textValue }) => textValue ? theme.variant['primary-2'] : theme.variant['neutral-3']};
63
- }
64
- `;
65
-
66
- const requiredAsterisk = css`
67
- &:after {
68
- content:" *";
69
- color: ${({ theme }) => theme.variant['error']};
70
- }
71
- `
72
-
73
- const Label = styled.label`
74
- display: block;
75
- margin-bottom: ${({ labelInline, errMsg }) => (labelInline && errMsg) ? '18px' : '8px'};
76
- margin-right: ${({ labelInline }) => labelInline ? '10px' : ''};
77
- color: ${({ theme }) => theme.variant['neutral-2']};
78
- ${({ required }) => required ? requiredAsterisk : null}
79
- `;
80
-
81
- const inline = css`
82
- display: flex;
83
- align-items: center;
84
- `
85
-
86
- const Form = styled.div`
87
- ${({ labelInline }) => labelInline ? inline : null}
88
- z-index: 1;
89
- .err-text {
90
- color: ${({ theme }) => theme.variant['error']};
91
- margin-top: 5px;
92
- font-size: 10px;
93
- }
94
-
95
- > div {
96
- flex: 1 0 auto;
97
- }
98
- `
99
-
100
- const StyledP = styled.p`
101
- margin: 0 0 0 10px;
102
- color: #6B747F;
103
- white-space: nowrap;
104
- cursor: ${({ isSearchable, menuIsOpen }) => !isSearchable ? 'pointer' : menuIsOpen ? 'default' : 'pointer'};
105
- `
106
-
107
- const TextInputClicableMS = forwardRef(({ isSearchable, qtySelected, label, errMsg, iconBefore, iconAfter, onClick, onBlur, iconVariant, readonly, value, placeHolder, onChange, inputText, textValue, autofocusP, menuIsOpen, ...props }, ref) => {
108
- const theme = useTheme() || defaultThemeColor;
109
-
110
- return (
111
- <Form {...props}>
112
- <Label {...props} errMsg={errMsg} >
113
- {label}
114
- </Label>
115
- <div ref={ref.refForm}>
116
- <InputBorder menuIsOpen={menuIsOpen}></InputBorder>
117
- <TextBox
118
- {...props}
119
- onClick={!isSearchable ? onClick : menuIsOpen ? null : onClick} //if menu is close onClickon input open it. If open cannot close but type in it
120
- >
121
-
122
- <div className="input-icon">
123
- {iconBefore}
124
- </div>
125
- <Input
126
- {...props}
127
- ref={ref.refInput}
128
- readOnly={readonly}
129
- onChange={onChange}
130
- value={value}
131
- placeholder={placeHolder}
132
- textValue={textValue} //for styling
133
- autoFocus={autofocusP}
134
- menuIsOpen={menuIsOpen}
135
- isSearchable={isSearchable}
136
- size='1'
137
- />
138
- {qtySelected > 1 && <StyledP menuIsOpen={menuIsOpen} isSearchable={isSearchable} style={{}}>& {qtySelected - 1} more</StyledP>}
139
- <div className="input-icon" onClick={onClick} style={{ padding: '10px 12px', alignSelf: 'stretch', alignItems: 'center', top: '0px', bottom: '0px', right: '0px', display: 'flex' }}>
140
- {iconAfter}
141
- </div>
142
- </TextBox>
143
- {!menuIsOpen && <div className='err-text'>{errMsg}</div>}
144
- </div>
145
- </Form>
146
- )
147
- })
148
-
149
- TextBox.defaultProps = {
150
- theme: defaultThemeColor,
151
- }
152
-
153
- Form.defaultProps = {
154
- theme: defaultThemeColor,
155
- }
156
-
157
- Label.defaultProps = {
158
- theme: defaultThemeColor,
159
- }
160
-
161
- Input.defaultProps = {
162
- theme: defaultThemeColor,
163
- }
164
-
165
- TextInputClicableMS.propTypes = {
166
- /**
167
- * Theme props
168
- */
169
- theme: PropTypes.object,
170
- /**
171
- * Label of Input
172
- */
173
- label: PropTypes.string,
174
- /**
175
- * Is the input required?
176
- */
177
- required: PropTypes.bool,
178
- /**
179
- * Should label be inline?
180
- */
181
- labelInline: PropTypes.bool,
182
- /**
183
- * Is the input correct?
184
- */
185
- isValid: PropTypes.bool,
186
- /**
187
- * Error Message
188
- */
189
- errMsg: PropTypes.string,
190
- /**
191
- * Icon before input value
192
- */
193
- iconBefore: PropTypes.any,
194
- /**
195
- * Icon after input value
196
- */
197
- iconAfter: PropTypes.any,
198
- /**
199
- * Boolean to enable disable pointer style
200
- */
201
- isSearchable: PropTypes.bool,
202
- /**
203
- * Value of the item selected when > 1
204
- */
205
- qtySelected: PropTypes.number,
206
- /**
207
- * Click handler
208
- */
209
- onClick: PropTypes.func,
210
- /**
211
- * Icon color
212
- */
213
- iconVariant: PropTypes.string,
214
- /**
215
- * Make input not editable
216
- */
217
- readonly: PropTypes.bool,
218
- /**
219
- * Value of the input
220
- */
221
- value: PropTypes.string,
222
- /**
223
- * Placeholder of the input
224
- */
225
- placeHolder: PropTypes.string,
226
- /**
227
- * Change handler
228
- */
229
- onChange: PropTypes.func,
230
- /**
231
- * Apply different style to the place holder
232
- */
233
- textValue: PropTypes.string,
234
- /**
235
- * Autofocus the input
236
- */
237
- autofocusP: PropTypes.bool,
238
- /**
239
- * Apply different style
240
- */
241
- menuIsOpen: PropTypes.bool,
242
- }
243
-
244
- TextInputClicableMS.defaultProps = {
245
- theme: defaultThemeColor,
246
- label: '',
247
- required: false,
248
- labelInline: false,
249
- isValid: true,
250
- errMsg: '',
251
- iconBefore: null,
252
- iconAfter: null,
253
- }
254
-
255
- export default TextInputClicableMS;
@@ -1,116 +0,0 @@
1
- import React, { useRef, useEffect, useCallback } from 'react';
2
- import styled from 'styled-components';
3
- import defaultStyles from '../constants/defaultStyle';
4
- import getDefaultStyles from '../constants/utils';
5
- import PropTypes from "prop-types";
6
-
7
-
8
- const Background = styled.div`
9
- //Set the styles from the default styles object
10
- ${({ theme, type }) => {
11
- return getDefaultStyles(theme, type);
12
- }}
13
-
14
- // custom styles
15
- ${({ customBackgroundStyle }) => customBackgroundStyle}
16
- `;
17
-
18
- const ModalWrapper = styled.div`
19
-
20
- //Set the styles from the default styles object
21
- ${({ theme, type }) => {
22
- return getDefaultStyles(theme, type);
23
- }}
24
-
25
- // custom styles
26
- ${({ customWrapperStyle }) => customWrapperStyle}
27
- `;
28
-
29
- const CloseModalButton = styled.div`
30
- //Set the styles from the default styles object
31
- ${({ theme, type }) => {
32
- return getDefaultStyles(theme, type);
33
- }}
34
-
35
- // custom styles
36
- ${({ closeModalButtonStyle }) => closeModalButtonStyle}
37
- `;
38
-
39
- export const Modal = ({ showModal, setShowModal, customBackgroundStyle, customWrapperStyle, modalCloseButton, closeModalButtonStyle, children,...props }) => {
40
- const modalRef = useRef();
41
-
42
- const closeModal = e => {
43
- if (modalRef.current === e.target) {
44
- setShowModal(false);
45
- }
46
- };
47
-
48
- const keyPress = useCallback(
49
- e => {
50
- if (e.key === 'Escape' && showModal) {
51
- setShowModal(false);
52
- }
53
- },
54
- [setShowModal, showModal]
55
- );
56
-
57
- useEffect(
58
- () => {
59
- document.addEventListener('keydown', keyPress);
60
- return () => document.removeEventListener('keydown', keyPress);
61
- },
62
- [keyPress]
63
- );
64
-
65
- return (
66
- <div>
67
- {showModal ? (
68
- <Background
69
- theme={defaultStyles}
70
- type={'modal-background'}
71
- onClick={closeModal}
72
- ref={modalRef}
73
- customBackgroundStyle={customBackgroundStyle} {...props}>
74
- <ModalWrapper
75
- theme={defaultStyles}
76
- type={'modal-wrapper'}
77
- showModal={showModal}
78
- customWrapperStyle={customWrapperStyle} {...props}>
79
- {modalCloseButton &&
80
- <CloseModalButton
81
- onClick={() => setShowModal(prev => !prev)}
82
- theme={defaultStyles}
83
- type={'modal-close-button'}
84
- closeModalButtonStyle={closeModalButtonStyle}>
85
- X
86
- </CloseModalButton>}
87
-
88
- {children}
89
- </ModalWrapper>
90
- </Background>
91
- ) : null}
92
- </div>
93
- );
94
- };
95
-
96
- Modal.propTypes = {
97
- /**
98
- * Show modal
99
- */
100
- showModal: PropTypes.bool.isRequired,
101
- /**
102
- * Show modal function
103
- */
104
- setShowModal: PropTypes.func.isRequired,
105
- /**
106
- * Show modal close button or not
107
- */
108
- modalCloseButton: PropTypes.bool,
109
- }
110
-
111
- Modal.defaultProps = {
112
- showModal: false,
113
- setShowModal: ()=>{},
114
- modalCloseButton: true,
115
- }
116
-