groundfloor-react-ui 1.2.8 → 1.2.10

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 (186) hide show
  1. package/dist/index.es.js +461 -430
  2. package/dist/index.js +469 -438
  3. package/package.json +15 -43
  4. package/rollup.config.js +6 -6
  5. package/assets/fonts/Averta/Averta-Black.woff2 +0 -0
  6. package/assets/fonts/Averta/Averta-BlackItalic.woff2 +0 -0
  7. package/assets/fonts/Averta/Averta-Bold.woff2 +0 -0
  8. package/assets/fonts/Averta/Averta-BoldItalic.woff2 +0 -0
  9. package/assets/fonts/Averta/Averta-ExtraBold.woff2 +0 -0
  10. package/assets/fonts/Averta/Averta-ExtraBoldItalic.woff2 +0 -0
  11. package/assets/fonts/Averta/Averta-ExtraThin.woff2 +0 -0
  12. package/assets/fonts/Averta/Averta-ExtraThinItalic.woff2 +0 -0
  13. package/assets/fonts/Averta/Averta-Light.woff2 +0 -0
  14. package/assets/fonts/Averta/Averta-LightItalic.woff2 +0 -0
  15. package/assets/fonts/Averta/Averta-Regular.woff2 +0 -0
  16. package/assets/fonts/Averta/Averta-RegularItalic.woff2 +0 -0
  17. package/assets/fonts/Averta/Averta-SemiBold.woff2 +0 -0
  18. package/assets/fonts/Averta/Averta-SemiBoldItalic.woff2 +0 -0
  19. package/assets/fonts/Averta/Averta-Thin.woff2 +0 -0
  20. package/assets/fonts/Averta/Averta-ThinItalic.woff2 +0 -0
  21. package/assets/fonts/Beauty/BeautyDemo.woff +0 -0
  22. package/assets/icons/app-logo.svg +0 -3
  23. package/assets/icons/arrow-down.svg +0 -3
  24. package/assets/icons/arrow-rotate.svg +0 -1
  25. package/assets/icons/arrow-up.svg +0 -3
  26. package/assets/icons/bell.svg +0 -3
  27. package/assets/icons/check.svg +0 -3
  28. package/assets/icons/checkmark.svg +0 -3
  29. package/assets/icons/chevron-down.svg +0 -3
  30. package/assets/icons/chevron-left.svg +0 -3
  31. package/assets/icons/chevron-right.svg +0 -3
  32. package/assets/icons/cloud-icon.svg +0 -3
  33. package/assets/icons/connection.svg +0 -3
  34. package/assets/icons/cross-icon.svg +0 -3
  35. package/assets/icons/default.svg +0 -1
  36. package/assets/icons/door-internal-active.svg +0 -1
  37. package/assets/icons/edit-icon.svg +0 -3
  38. package/assets/icons/ellipses-horizontal.svg +0 -3
  39. package/assets/icons/ellipses.svg +0 -3
  40. package/assets/icons/email.svg +0 -3
  41. package/assets/icons/eye-hide-view.svg +0 -1
  42. package/assets/icons/eye-hide.svg +0 -1
  43. package/assets/icons/file-attach-white.svg +0 -3
  44. package/assets/icons/file-attach.svg +0 -3
  45. package/assets/icons/file-icon.svg +0 -1
  46. package/assets/icons/file-upload.svg +0 -3
  47. package/assets/icons/functional-equation-regular.svg +0 -147
  48. package/assets/icons/hamburger-menu.svg +0 -3
  49. package/assets/icons/heart.svg +0 -18
  50. package/assets/icons/image.svg +0 -3
  51. package/assets/icons/info.svg +0 -3
  52. package/assets/icons/jpg-icon.svg +0 -3
  53. package/assets/icons/magnifier.svg +0 -3
  54. package/assets/icons/menu-ellipse-two.svg +0 -1
  55. package/assets/icons/menu-ellipse.svg +0 -53
  56. package/assets/icons/pause-all.svg +0 -1
  57. package/assets/icons/pdf-icon.svg +0 -3
  58. package/assets/icons/pen-icon.svg +0 -3
  59. package/assets/icons/plus-outlined.svg +0 -3
  60. package/assets/icons/resume.svg +0 -1
  61. package/assets/icons/sign-icon.svg +0 -3
  62. package/assets/icons/star.svg +0 -3
  63. package/assets/icons/trash-icon.svg +0 -59
  64. package/assets/icons/triangle-down.svg +0 -3
  65. package/assets/icons/users.svg +0 -11
  66. package/assets/icons/view.svg +0 -3
  67. package/assets/icons/watcher.svg +0 -3
  68. package/assets/icons/zoom-in-white.svg +0 -1
  69. package/assets/styles/global.css +0 -0
  70. package/assets/styles/global.scss +0 -0
  71. package/components/Accordion/Accordion.js +0 -167
  72. package/components/Accordion/AccordionSB.js +0 -170
  73. package/components/Accordion/AccordionSBfooter.js +0 -171
  74. package/components/Accordion/index.js +0 -4
  75. package/components/ArrowBar/ArrowBar.js +0 -276
  76. package/components/ArrowBar/index.js +0 -2
  77. package/components/Avatar/Avatar.js +0 -171
  78. package/components/Avatar/AvatarSB.js +0 -255
  79. package/components/Avatar/AvatarSBfooter.js +0 -279
  80. package/components/Avatar/index.js +0 -4
  81. package/components/Banner/Banner.js +0 -70
  82. package/components/Banner/index.js +0 -2
  83. package/components/Breadcrumb/Breadcrumb.js +0 -225
  84. package/components/Breadcrumb/index.js +0 -2
  85. package/components/Button/PrimaryButton.js +0 -167
  86. package/components/Button/SecondaryButton.js +0 -156
  87. package/components/Button/TinyButton.js +0 -101
  88. package/components/Button/index.js +0 -6
  89. package/components/Cards/Card.js +0 -43
  90. package/components/Cards/CardRef.js +0 -71
  91. package/components/Cards/DocumentCard.js +0 -215
  92. package/components/Cards/index.js +0 -5
  93. package/components/Content/Content.js +0 -50
  94. package/components/Content/index.js +0 -1
  95. package/components/DesignComponent/StyledComponent/StyledComponent.js +0 -326
  96. package/components/DesignComponent/StyledComponent/index.js +0 -1
  97. package/components/DesignComponent/index.js +0 -1
  98. package/components/Divider/Divider.js +0 -56
  99. package/components/Divider/index.js +0 -2
  100. package/components/Drawer/Drawer.js +0 -84
  101. package/components/Drawer/index.js +0 -2
  102. package/components/ErrorBoundary/ErrorBoundary.js +0 -44
  103. package/components/ErrorBoundary/index.js +0 -1
  104. package/components/FilterChip/FilterChip.js +0 -70
  105. package/components/FilterChip/index.js +0 -1
  106. package/components/Footer/Footer.js +0 -57
  107. package/components/Footer/FooterContent.js +0 -98
  108. package/components/Footer/index.js +0 -3
  109. package/components/Form/FormComponent.js +0 -244
  110. package/components/Form/HeaderComponent.js +0 -64
  111. package/components/Form/SubmitComponent.js +0 -63
  112. package/components/Form/index.js +0 -5
  113. package/components/GroupAvatars/GroupAvatars.js +0 -139
  114. package/components/GroupAvatars/index.js +0 -1
  115. package/components/GroupButtons/ButtonPopup.js +0 -191
  116. package/components/GroupButtons/GroupButtons.js +0 -150
  117. package/components/GroupButtons/GroupButtonsPopup.js +0 -163
  118. package/components/GroupButtons/index.js +0 -3
  119. package/components/GroupStatusCircle/GroupStatusCircle.js +0 -135
  120. package/components/GroupStatusCircle/index.js +0 -1
  121. package/components/Header/Header.js +0 -58
  122. package/components/Header/index.js +0 -1
  123. package/components/HyperLink/HyperLink.js +0 -114
  124. package/components/HyperLink/index.js +0 -1
  125. package/components/Icon/Icon.js +0 -176
  126. package/components/Icon/index.js +0 -1
  127. package/components/Images/Image.js +0 -107
  128. package/components/Images/index.js +0 -2
  129. package/components/Inputs/CheckBoxInput.js +0 -339
  130. package/components/Inputs/ColorInput.js +0 -145
  131. package/components/Inputs/DateSelect.js +0 -461
  132. package/components/Inputs/DropdownSelect.js +0 -690
  133. package/components/Inputs/DropzoneInput.js +0 -450
  134. package/components/Inputs/NumericInput.js +0 -166
  135. package/components/Inputs/PasswordInput.js +0 -242
  136. package/components/Inputs/RadioInput.js +0 -292
  137. package/components/Inputs/SearchInput.js +0 -19
  138. package/components/Inputs/Signature.js +0 -369
  139. package/components/Inputs/TextArea.js +0 -214
  140. package/components/Inputs/TextInput.js +0 -235
  141. package/components/Inputs/TimeInput.js +0 -186
  142. package/components/Inputs/ToggleSwitch.js +0 -157
  143. package/components/Inputs/index.js +0 -15
  144. package/components/Label/Label.js +0 -48
  145. package/components/Label/index.js +0 -1
  146. package/components/Loaders/Loader.js +0 -179
  147. package/components/Loaders/index.js +0 -2
  148. package/components/Modal/ModalComp.js +0 -216
  149. package/components/Modal/index.js +0 -1
  150. package/components/Overlay/Overlay.js +0 -158
  151. package/components/Overlay/index.js +0 -1
  152. package/components/Pagination/Pagination.js +0 -59
  153. package/components/Pagination/index.js +0 -1
  154. package/components/ProgressBar/ProgressBar.js +0 -101
  155. package/components/ProgressBar/index.js +0 -1
  156. package/components/ProgressSteps/ProgressSteps.js +0 -121
  157. package/components/ProgressSteps/index.js +0 -1
  158. package/components/Rating/Rating.js +0 -258
  159. package/components/Rating/index.js +0 -1
  160. package/components/SecondaryLink/DarkSecondaryLink.js +0 -97
  161. package/components/SecondaryLink/LightSecondaryLink.js +0 -93
  162. package/components/SecondaryLink/index.js +0 -3
  163. package/components/Sidebar/Navbar.js +0 -306
  164. package/components/Sidebar/Sidebar.js +0 -207
  165. package/components/Sidebar/index.js +0 -3
  166. package/components/StatusChip/PrimaryStatusChip.js +0 -78
  167. package/components/StatusChip/SecondaryStatusChip.js +0 -78
  168. package/components/StatusChip/SlimPrimaryStatusChip.js +0 -92
  169. package/components/StatusChip/SlimSecondaryStatusChip.js +0 -93
  170. package/components/StatusChip/index.js +0 -6
  171. package/components/StatusCircle/StatusCircle.js +0 -64
  172. package/components/StatusCircle/index.js +0 -1
  173. package/components/Tables/Table.js +0 -178
  174. package/components/Tables/index.js +0 -1
  175. package/components/Tooltip/Tooltip.js +0 -581
  176. package/components/Tooltip/index.js +0 -1
  177. package/components/Typography/Typography.js +0 -77
  178. package/components/Typography/index.js +0 -2
  179. package/components/constants/colors.js +0 -33
  180. package/components/constants/defaultStyle.js +0 -801
  181. package/components/constants/defaultThemeColor.js +0 -16
  182. package/components/constants/index.js +0 -7
  183. package/components/constants/utils.js +0 -31
  184. package/components/global/FontStyle.js +0 -131
  185. package/components/global/index.js +0 -1
  186. package/index.js +0 -41
@@ -1,369 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, { useEffect, useRef, useState } from 'react';
3
- import SignaturePad from 'react-signature-pad-wrapper';
4
- import styled, { useTheme } from 'styled-components';
5
- import defaultStyles from '../constants/defaultStyle';
6
- import defaultThemeColor from '../constants/defaultThemeColor';
7
- import getDefaultStyles from '../constants/utils';
8
- import { Icon } from '../Icon';
9
-
10
- const ParentDiv = styled.div`
11
- //Set the styles from the default styles object
12
- ${({ inBuiltCss, defaultParentDivStyle }) => {
13
- return getDefaultStyles(inBuiltCss, defaultParentDivStyle);
14
- }}
15
-
16
- border: 1px solid ${({
17
- isMyInputFocused,
18
- activeColor,
19
- defaultColor,
20
- theme,
21
- }) => {
22
- if (isMyInputFocused && activeColor) return activeColor;
23
- else if (isMyInputFocused && !activeColor)
24
- return theme.primary['primary-1'];
25
- else if (!isMyInputFocused && defaultColor) return defaultColor;
26
- else if (!isMyInputFocused && !defaultColor)
27
- return theme.neutral['neutral-3'];
28
- }};
29
-
30
- &:focus-within {
31
- border-color: ${({ activeColor, theme }) =>
32
- activeColor ? activeColor : theme.primary['primary-1']};
33
- }
34
- `;
35
-
36
- const WrapperDiv = styled.div`
37
- //Set the styles from the default styles object
38
- ${({ inBuiltCss, defaultWrapperDivStyle }) => {
39
- return getDefaultStyles(inBuiltCss, defaultWrapperDivStyle);
40
- }}
41
-
42
- flex-direction: ${({ signIcon }) => (signIcon ? 'column' : 'initial')};
43
- width: ${({ signIcon }) =>
44
- signIcon ? 'min-content' : 'calc(100% - 50px) !important'};
45
- max-width: ${({ signIcon }) => (signIcon ? '42px' : '490px')};
46
- border-right: 1px solid
47
- ${({ activeColor, defaultColor, isMyInputFocused, signIcon, theme }) => {
48
- if (signIcon && isMyInputFocused && activeColor) return activeColor;
49
- else if (signIcon && isMyInputFocused && !activeColor)
50
- return theme.primary['primary-1'];
51
- else if (signIcon && !isMyInputFocused && defaultColor)
52
- return defaultColor;
53
- else if (signIcon && !isMyInputFocused && !defaultColor)
54
- return theme.neutral['neutral-3'];
55
- else if (!signIcon) return 'none';
56
- }};
57
- border-left: ${({ signIcon }) => (!signIcon ? 'none' : '')};
58
- margin-left: ${({ signIcon }) => (!signIcon ? '42px' : '')};
59
- position: ${({ signIcon }) => (!signIcon ? '' : 'absolute')};
60
- `;
61
-
62
- const ControllerDiv = styled.div`
63
- width: 39px;
64
- height: 44px;
65
- display: flex;
66
- flex-direction: row;
67
- justify-content: center;
68
- align-items: center;
69
- border-bottom: ${({
70
- penIcon,
71
- isMyInputFocused,
72
- activeColor,
73
- defaultColor,
74
- theme,
75
- }) =>
76
- penIcon
77
- ? isMyInputFocused
78
- ? `1px solid ` +
79
- `${activeColor ? activeColor : theme.primary['primary-1']}`
80
- : `1px solid ` +
81
- `${defaultColor ? defaultColor : theme.neutral['neutral-3']}`
82
- : ''};
83
- background-color: rgba(255, 255, 255, 0.05);
84
- cursor: pointer;
85
- `;
86
-
87
- const InputText = styled.input`
88
- ${({ inBuiltCss, defaultInputStyle }) => {
89
- return getDefaultStyles(inBuiltCss, defaultInputStyle);
90
- }}
91
-
92
- border-bottom: ${({ value, defaultColor, theme }) =>
93
- value.length > 0
94
- ? 'none'
95
- : '1px solid ' + defaultColor
96
- ? defaultColor
97
- : theme.neutral['neutral-3']};
98
-
99
- &::placeholder {
100
- font-size: 17px;
101
- text-align: center;
102
- color: ${({ placeholderColor, theme }) =>
103
- placeholderColor ? placeholderColor : theme.neutral['neutral-3']};
104
- font-family: 'Averta';
105
- font-style: normal;
106
- font-weight: normal;
107
- line-height: 22px;
108
- }
109
- &: focus-within {
110
- border: none;
111
- outline: none;
112
-
113
- ::placeholder {
114
- color: transparent;
115
- }
116
- }
117
-
118
- // custom styles
119
- ${({ customInputStyle }) => customInputStyle}
120
- `;
121
-
122
- const SignaturePadDiv = styled.div`
123
- position: relative;
124
- width: inherit;
125
- display: flex;
126
- margin: 4px;
127
- `;
128
-
129
- const IconDiv = styled.div`
130
- padding-left: 2px;
131
- display: flex;
132
- justify-content: center;
133
- cursor: pointer;
134
- `;
135
-
136
- export const SignatureInput = ({
137
- onChange,
138
- activeColor,
139
- defaultColor,
140
- placeholderColor,
141
- placeholderText,
142
- customInputStyle,
143
- pointsArray,
144
- setPointsArray,
145
- value,
146
- setValue,
147
- valueForSignatureDrawing,
148
- setValueForSignatureDrawing,
149
- imageURL,
150
- setImageURL,
151
- id,
152
- ...props
153
- }) => {
154
- const activeTheme = useTheme() || defaultThemeColor;
155
- const [selected, setSelected] = useState('default');
156
- const [isMyInputFocused, setIsMyInputFocused] = useState(false);
157
- const [dirty, setDirty] = useState(false);
158
- const pad = useRef(null);
159
-
160
- useEffect(() => {
161
- if (dirty) {
162
- save();
163
- setValueForSignatureDrawing(pad.current);
164
- }
165
- }, [dirty === true]);
166
-
167
- const onClear = () => {
168
- setValue('');
169
- setValueForSignatureDrawing(pad.current);
170
- if (pad.current) {
171
- pad.current.clear();
172
- }
173
- setIsMyInputFocused(false);
174
- setDirty(false);
175
- };
176
-
177
- const save = () => {
178
- setPointsArray(pad.current.toData());
179
- setImageURL(pad.current.toDataURL('image/png'));
180
- return [imageURL, pointsArray];
181
- };
182
-
183
- return (
184
- <ParentDiv
185
- inBuiltCss={defaultStyles}
186
- defaultParentDivStyle={'signature-parent-div'}
187
- isMyInputFocused={isMyInputFocused}
188
- selected={selected}
189
- activeColor={activeColor}
190
- defaultColor={defaultColor}
191
- theme={activeTheme}
192
- >
193
- <WrapperDiv
194
- inBuiltCss={defaultStyles}
195
- defaultWrapperDivStyle={'signature-wrapper-div'}
196
- activeColor={activeColor}
197
- defaultColor={defaultColor}
198
- selected={selected}
199
- isMyInputFocused={isMyInputFocused}
200
- signIcon={true}
201
- theme={activeTheme}
202
- >
203
- <ControllerDiv
204
- activeColor={activeColor}
205
- defaultColor={defaultColor}
206
- isMyInputFocused={isMyInputFocused}
207
- theme={activeTheme}
208
- penIcon={true}
209
- onClick={() => {
210
- setSelected('default');
211
- onClear();
212
- }}
213
- >
214
- <Icon
215
- icon='pen-icon'
216
- color={
217
- selected === 'default'
218
- ? activeColor
219
- ? activeColor
220
- : activeTheme.primary['primary-1']
221
- : activeTheme.black
222
- }
223
- />
224
- </ControllerDiv>
225
- <ControllerDiv
226
- activeColor={activeColor}
227
- defaultColor={defaultColor}
228
- theme={activeTheme}
229
- isMyInputFocused={isMyInputFocused}
230
- penIcon={false}
231
- onClick={() => {
232
- setSelected('sign');
233
- onClear();
234
- }}
235
- >
236
- <Icon
237
- icon='sign-icon'
238
- color={
239
- selected !== 'default'
240
- ? activeColor
241
- ? activeColor
242
- : activeTheme.primary['primary-1']
243
- : activeTheme.black
244
- }
245
- />
246
- </ControllerDiv>
247
- </WrapperDiv>
248
- <WrapperDiv
249
- inBuiltCss={defaultStyles}
250
- defaultWrapperDivStyle={'signature-wrapper-div'}
251
- activeColor={activeColor}
252
- defaultColor={defaultColor}
253
- theme={activeTheme}
254
- selected={selected}
255
- isMyInputFocused={isMyInputFocused}
256
- signIcon={false}
257
- onTouchStart={() => { }}
258
- >
259
- {selected === 'default' ? (
260
- <InputText
261
- inBuiltCss={defaultStyles}
262
- defaultInputStyle={'signature-input-text'}
263
- placeholder={placeholderText}
264
- placeholderColor={placeholderColor}
265
- customInputStyle={customInputStyle}
266
- onBlur={() => setIsMyInputFocused(false)}
267
- onFocus={() => setIsMyInputFocused(true)}
268
- id={id}
269
- value={value}
270
- defaultColor={defaultColor}
271
- theme={activeTheme}
272
- onChange={(e) => setValue(e.target.value)}
273
- />
274
- ) : (
275
- <SignaturePadDiv
276
- onMouseEnter={() => setIsMyInputFocused(true)}
277
- onMouseLeave={() => setIsMyInputFocused(false)}
278
- onClick={() => {
279
- setDirty(true);
280
- save();
281
- }}
282
- >
283
- <SignaturePad
284
- ref={pad}
285
- id={id}
286
- redrawOnResize
287
- height={75}
288
- options={{ minWidth: 1, maxWidth: 1, penColor: '#444444' }}
289
- />
290
- </SignaturePadDiv>
291
- )}
292
- {(value || dirty) && (
293
- <IconDiv selected={selected} onClick={() => onClear()}>
294
- <Icon
295
- icon='cross-icon'
296
- color={
297
- defaultColor ? defaultColor : activeTheme.neutral['neutral-3']
298
- }
299
- />
300
- </IconDiv>
301
- )}
302
- </WrapperDiv>
303
- </ParentDiv>
304
- );
305
- };
306
-
307
- SignatureInput.propTypes = {
308
- /**
309
- * Active Color for the signature
310
- */
311
- activeColor: PropTypes.string,
312
- /**
313
- * Default Color for the signature
314
- */
315
- defaultColor: PropTypes.string,
316
- /**
317
- * PlaceHolder Color for the signature
318
- */
319
- placeholderColor: PropTypes.string,
320
- /**
321
- * PlaceHolder text
322
- */
323
- placeholderText: PropTypes.string,
324
- /**
325
- * Custom style of the input text
326
- */
327
- customInputStyle: PropTypes.object,
328
- /**
329
- * Array of points for the signature
330
- */
331
- pointsArray: PropTypes.any,
332
- /**
333
- * Function that sets the Array of points for the signature
334
- */
335
- setPointsArray: PropTypes.func,
336
- /**
337
- * Signature Text
338
- */
339
- value: PropTypes.string,
340
- /**
341
- * Signature Text Setter
342
- */
343
- setValue: PropTypes.func,
344
- /**
345
- * Image url of the Signature drawing
346
- */
347
- imageURL: PropTypes.string,
348
- /**
349
- * Function that sets Image url of the Signature drawing
350
- */
351
- setImageURL: PropTypes.func,
352
- /**
353
- * id of the signature input
354
- */
355
- id: PropTypes.string,
356
- };
357
-
358
- SignatureInput.defaultProps = {
359
- customInputStyle: {},
360
- placeholderText: 'Type your signature here',
361
- pointsArray: null,
362
- setPointsArray: () => { },
363
- value: '',
364
- setValue: () => { },
365
- imageURL: '',
366
- setImageURL: () => { },
367
- setValueForSignatureDrawing: () => { },
368
- id: ''
369
- };
@@ -1,214 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import styled, { css, useTheme } from 'styled-components';
4
- import defaultStyles from '../constants/defaultStyle';
5
- import defaultThemeColor from '../constants/defaultThemeColor';
6
- import getDefaultStyles from '../constants/utils';
7
- import { Label } from '../Label';
8
-
9
- const TextWrapper = styled.div`
10
- //Set the styles from the default styles object
11
- ${({ inBuiltCss, defaultWrapperStyle }) => {
12
- return getDefaultStyles(inBuiltCss, defaultWrapperStyle);
13
- }}
14
-
15
- border: ${({ isValid, theme }) =>
16
- !isValid
17
- ? '1px solid ' + theme.variant['error']
18
- : '1px solid ' + theme.border};
19
-
20
- .input-icon svg path {
21
- fill: ${({ theme }) => theme.variant['neutral-1']};
22
- }
23
-
24
- &:focus-within {
25
- border: 1px solid ${({ theme }) => theme.variant['primary-1']};
26
- outline: none;
27
-
28
- .input-icon svg path {
29
- fill: ${({ theme }) => theme.variant['primary-1']};
30
- }
31
- }
32
-
33
- // custom styles
34
- ${({ textAreaStyle }) => textAreaStyle}
35
- `;
36
-
37
- const Input = styled.textarea`
38
- //Set the styles from the default styles object
39
- ${({ inBuiltCss, defaultInputStyle }) => {
40
- return getDefaultStyles(inBuiltCss, defaultInputStyle);
41
- }}
42
- margin: 0;
43
- overflow: auto;
44
- resize: vertical // custom styles
45
- ${({ inputStyle }) => inputStyle};
46
- `;
47
-
48
- const inline = css`
49
- display: flex;
50
- gap: 7px;
51
- align-items: center;
52
- `;
53
-
54
- const Form = styled.div`
55
- ${({ labelInline }) => (labelInline ? inline : null)}
56
- ${({ customStylesForm }) => {
57
- if (customStylesForm) {
58
- return { ...customStylesForm };
59
- }
60
- }}
61
- position: relative;
62
- .err-text {
63
- color: ${({ theme }) => theme.variant['error']};
64
- margin-top: 5px;
65
- font-size: 10px;
66
- }
67
- `;
68
-
69
- export const TextArea = React.forwardRef(
70
- (
71
- {
72
- customStylesForm,
73
- textAreaStyle,
74
- labelStyle,
75
- inputStyle,
76
- errMsg,
77
- required,
78
- label,
79
- labelInline,
80
- iconBefore,
81
- iconAfter,
82
- isValid,
83
- rows,
84
- cols,
85
- id,
86
- ...props
87
- },
88
- ref
89
- ) => {
90
- const activeTheme = useTheme() || defaultThemeColor;
91
-
92
- return (
93
- <Form
94
- labelInline={labelInline}
95
- customStylesForm={customStylesForm}
96
- theme={activeTheme}
97
- {...props}
98
- >
99
- <div style={{ display: 'flex' }}>
100
- <Label
101
- customStyles={labelStyle}
102
- type={'label-text'}
103
- labelInline={labelInline}
104
- text={label}
105
- errMsg={errMsg}
106
- style={{
107
- display: 'flex',
108
- marginBottom: `${!labelInline ? '7px' : ''}`,
109
- paddingBottom: '0px',
110
- }}
111
- {...props}
112
- />
113
- {required && (
114
- <div
115
- style={{
116
- marginLeft: '4px',
117
- color: `${activeTheme.variant['error']}`,
118
- }}
119
- >
120
- *
121
- </div>
122
- )}
123
- </div>
124
- <TextWrapper
125
- theme={activeTheme}
126
- required={required}
127
- textAreaStyle={textAreaStyle}
128
- isValid={isValid}
129
- inBuiltCss={defaultStyles}
130
- defaultWrapperStyle={'textbox-wrapper'}
131
- {...props}
132
- >
133
- <div className='input-icon'>{iconBefore}</div>
134
- <Input
135
- ref={ref}
136
- inputStyle={inputStyle}
137
- defaultInputStyle={'textarea-wrapper'}
138
- cols={cols}
139
- rows={rows}
140
- inBuiltCss={defaultStyles}
141
- id={id}
142
- {...props}
143
- size='1'
144
- />
145
- <div className='input-icon'>{iconAfter}</div>
146
- </TextWrapper>
147
- <div className='err-text'>{errMsg}</div>
148
- </Form>
149
- );
150
- }
151
- );
152
-
153
- TextArea.propTypes = {
154
- /**
155
- * row number of the text area
156
- */
157
- rows: PropTypes.number,
158
- /**
159
- * Label of Input
160
- */
161
- label: PropTypes.string,
162
- /**
163
- * Is the input required?
164
- */
165
- required: PropTypes.bool,
166
- /**
167
- * Should label be inline with textbox?
168
- */
169
- labelInline: PropTypes.bool,
170
- /**
171
- * Error Message
172
- */
173
- errMsg: PropTypes.string,
174
- /**
175
- * Icon before input value
176
- */
177
- iconBefore: PropTypes.any,
178
- /**
179
- * Icon after input value
180
- */
181
- iconAfter: PropTypes.any,
182
- /**
183
- * custom style of textbox Wrapper
184
- */
185
- textAreaStyle: PropTypes.object,
186
- /**
187
- * custom style of textbox input
188
- */
189
- labelStyle: PropTypes.object,
190
- /**
191
- * custom style of textbox label
192
- */
193
- inputStyle: PropTypes.object,
194
- /**
195
- * id of the textarea input
196
- */
197
- id: PropTypes.string,
198
- };
199
-
200
- TextArea.defaultProps = {
201
- label: '',
202
- required: false,
203
- isValid: true,
204
- labelInline: false,
205
- errMsg: '',
206
- iconBefore: null,
207
- iconAfter: null,
208
- textAreaStyle: {},
209
- labelStyle: {},
210
- inputStyle: {},
211
- rows: 3,
212
- // cols: 100
213
- id: ''
214
- };