groundfloor-react-ui 1.0.19 → 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.
@@ -1,8 +1,8 @@
1
- import React from "react";
2
1
  import PropTypes from 'prop-types';
2
+ import React from "react";
3
3
  import styled, { useTheme } from 'styled-components';
4
+ import { Avatar } from '../Avatar';
4
5
  import defaultThemeColor from '../constants/defaultThemeColor';
5
- import { Avatar } from '../Avatar'
6
6
  /**
7
7
  * Primary UI component for user interaction
8
8
  */
@@ -26,7 +26,7 @@ const StyledQty = styled.p`
26
26
  `;
27
27
 
28
28
  export const GroupAvatars = ({ items, block, size, variantCircle, variantName, variantQty, flagName, user, colorCircle, colorBorderCircle, ...props }) => {
29
- const theme = useTheme() || defaultThemeColor;
29
+ const activeTheme = useTheme() || defaultThemeColor;
30
30
 
31
31
  return (
32
32
  <StyledContainer block={block} {...props}>
@@ -36,13 +36,13 @@ export const GroupAvatars = ({ items, block, size, variantCircle, variantName, v
36
36
  let customStylesImage = {}
37
37
 
38
38
  if (colorCircle) {
39
- customStylesCircle.backgroundColor = `${theme.variant[colorCircle]}`
39
+ customStylesCircle.backgroundColor = `${activeTheme.variant[colorCircle]}`
40
40
  } else {
41
- customStylesCircle.backgroundColor = `${theme.variant[variantCircle]}`
41
+ customStylesCircle.backgroundColor = `${activeTheme.variant[variantCircle]}`
42
42
  }
43
43
  if (i !== 0) {
44
- customStylesCircle.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${theme.variant[variantCircle]}`
45
- customStylesImage.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${theme.variant[variantCircle]}`
44
+ customStylesCircle.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${activeTheme.variant[variantCircle]}`
45
+ customStylesImage.border = colorBorderCircle ? `2px solid ${colorBorderCircle}` : `2px solid ${activeTheme.variant[variantCircle]}`
46
46
  }
47
47
 
48
48
  return (
@@ -52,7 +52,7 @@ export const GroupAvatars = ({ items, block, size, variantCircle, variantName, v
52
52
  key={user.id}
53
53
  // variantCircle={variantCircle}
54
54
  customStylesContainer={{ width: 'auto' }}
55
- customStylesName={{ color: `${theme.variant[{ variantName }]}` }}
55
+ customStylesName={{ color: `${activeTheme.variant[{ variantName }]}` }}
56
56
  // block={false}
57
57
  size={size}
58
58
  toggleName={true}
@@ -68,7 +68,7 @@ export const GroupAvatars = ({ items, block, size, variantCircle, variantName, v
68
68
  // variantCircle={variantCircle}
69
69
  // variantName={variantName}
70
70
  customStylesContainer={{ width: 'auto' }}
71
- customStylesName={{ color: `${theme.variant[{ variantName }]}` }}
71
+ customStylesName={{ color: `${activeTheme.variant[{ variantName }]}` }}
72
72
  // block={false}
73
73
  size={size}
74
74
  toggleName={false}
@@ -82,7 +82,7 @@ export const GroupAvatars = ({ items, block, size, variantCircle, variantName, v
82
82
  ) : (null)
83
83
  )
84
84
  })}
85
- {(items.length - 4) > 0 ? (<StyledQty variantQty={variantQty}>+{items.length - 4}</StyledQty>) : null}
85
+ {(items.length - 4) > 0 ? (<StyledQty theme={activeTheme} variantQty={variantQty}>+{items.length - 4}</StyledQty>) : null}
86
86
  </StyledContainer>
87
87
  );
88
88
  };
@@ -122,12 +122,9 @@ GroupAvatars.propTypes = {
122
122
  variantQty: PropTypes.string,
123
123
  };
124
124
 
125
- StyledQty.defaultProps = {
126
- theme: defaultThemeColor,
127
- }
125
+
128
126
 
129
127
  GroupAvatars.defaultProps = {
130
- theme: defaultThemeColor,
131
128
  variantCircle: 'primary-1',
132
129
  variantName: 'primary-2',
133
130
  block: false,
@@ -139,5 +136,4 @@ GroupAvatars.defaultProps = {
139
136
  colorCircle: null,
140
137
  colorBorderCircle: "#FFFFFF",
141
138
  variantQty: 'primary-1'
142
- };
143
-
139
+ };
@@ -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, { useTheme } from 'styled-components';
4
4
  import defaultThemeColor from '../constants/defaultThemeColor';
5
5
  import { ButtonPopup } from './ButtonPopup';
@@ -8,7 +8,6 @@ import { ButtonPopup } from './ButtonPopup';
8
8
  * Primary UI component for user interaction
9
9
  */
10
10
 
11
- const buttonDisabledBg = '#BBC4CF';
12
11
 
13
12
  const StyledContainer = styled.div`
14
13
  display: flex;
@@ -19,11 +18,7 @@ const StyledContainer = styled.div`
19
18
  border-radius: 3px;
20
19
  `;
21
20
 
22
- const StyledTooltip = styled.div`
23
- background-color: indianred;
24
- visibility: hidden;
25
- pointer-events: none;
26
- `
21
+
27
22
 
28
23
  const StyledItem = styled.div`
29
24
  display: flex;
@@ -165,5 +160,4 @@ GroupButtonsPopup.defaultProps = {
165
160
  variantBgDisable: 'bgColor',
166
161
  variantTPtext: null,
167
162
  variantTPbg: null,
168
- };
169
-
163
+ };
@@ -4,9 +4,8 @@ import styled, { useTheme } from 'styled-components';
4
4
  import defaultStyles from '../constants/defaultStyle';
5
5
  import defaultThemeColor from '../constants/defaultThemeColor';
6
6
  import getDefaultStyles from '../constants/utils';
7
- import { Label } from '../Label';
8
- // import tick from '../../assets/icons/checkmark.svg';
9
7
  import { Icon } from '../Icon';
8
+ import { Label } from '../Label';
10
9
 
11
10
  const CheckBoxOuter = styled.div`
12
11
  box-sizing: initial;
@@ -16,13 +15,28 @@ const CheckBoxOuter = styled.div`
16
15
  return getDefaultStyles(inBuiltCss, defaultCheckBoxOuterStyle);
17
16
  }}
18
17
 
19
- border: 2px solid ${({ checkedCheckBoxColor, defaultBorderColor, checked }) =>
20
- checked ? checkedCheckBoxColor : defaultBorderColor};
18
+ border: 2px solid ${({
19
+ checkedCheckBoxColor,
20
+ defaultBorderColor,
21
+ checked,
22
+ theme,
23
+ }) => {
24
+ if (checked && checkedCheckBoxColor) return checkedCheckBoxColor;
25
+ else if (checked && !checkedCheckBoxColor)
26
+ return theme.primary['primary-1'];
27
+ else if (!checked && defaultBorderColor) return defaultBorderColor;
28
+ else if (!checked && !defaultBorderColor) return theme.border;
29
+ }}
30
+ };
21
31
 
22
32
  // custom styles
23
33
  ${({ checkBoxOuterStyle }) => checkBoxOuterStyle}
24
34
  `;
25
35
 
36
+ CheckBoxOuter.defaultProps = {
37
+ theme: defaultThemeColor,
38
+ };
39
+
26
40
  const CheckBoxInner = styled.div`
27
41
  box-sizing: initial;
28
42
 
@@ -32,11 +46,20 @@ const CheckBoxInner = styled.div`
32
46
  }}
33
47
 
34
48
  // background-image: url(${({ signCheck }) => signCheck});
35
- background-color: ${({ checked, checkedCheckBoxColor, theme }) =>
36
- checked ? checkedCheckBoxColor : theme.bgColor};
49
+ background-color: ${({ checked, checkedCheckBoxColor, theme }) => {
50
+ if (checked && checkedCheckBoxColor) return checkedCheckBoxColor;
51
+ else if (checked && !checkedCheckBoxColor)
52
+ return theme.primary['primary-1'];
53
+ else if (!checked) return theme.bgColor;
54
+ }};
37
55
  border: 2px solid
38
- ${({ checkedCheckBoxColor, defaultBorderColor, checked }) =>
39
- checked ? checkedCheckBoxColor : defaultBorderColor};
56
+ ${({ checkedCheckBoxColor, defaultBorderColor, checked, theme }) => {
57
+ if (checked && checkedCheckBoxColor) return checkedCheckBoxColor;
58
+ else if (checked && !checkedCheckBoxColor)
59
+ return theme.primary['primary-1'];
60
+ else if (!checked && defaultBorderColor) return defaultBorderColor;
61
+ else if (!checked && !defaultBorderColor) return theme.border;
62
+ }};
40
63
  display: flex;
41
64
  justify-content: center;
42
65
  align-items: center;
@@ -44,8 +67,7 @@ const CheckBoxInner = styled.div`
44
67
  ${({ checkBoxInnerStyle }) => checkBoxInnerStyle}
45
68
  `;
46
69
  CheckBoxInner.defaultProps = {
47
- themeColor: defaultThemeColor,
48
- // signCheck: `${tick}`
70
+ theme: defaultThemeColor,
49
71
  };
50
72
 
51
73
  const OptionText = styled.span`
@@ -54,14 +76,21 @@ const OptionText = styled.span`
54
76
  return getDefaultStyles(inBuiltCss, type);
55
77
  }}
56
78
 
57
- color: ${({ checked, defaultTextColor, checkedTextColor }) =>
58
- checked ? checkedTextColor : defaultTextColor};
79
+ color: ${({ theme, checked, defaultTextColor, checkedTextColor }) => {
80
+ if (checked && checkedTextColor) return checkedTextColor;
81
+ else if (checked && !checkedTextColor) return theme.neutral['neutral-1'];
82
+ else if (!checked && defaultTextColor) return defaultTextColor;
83
+ else if (!checked && !defaultTextColor) return theme.neutral['neutral-2'];
84
+ }};
59
85
 
60
86
  margin-right: ${({ inline }) => (inline ? '30px' : '0px')};
61
87
 
62
88
  // custom styles
63
89
  ${({ optionTextStyle }) => optionTextStyle}
64
90
  `;
91
+ OptionText.defaultProps = {
92
+ theme: defaultThemeColor,
93
+ };
65
94
 
66
95
  const WrapperDiv = styled.label`
67
96
  width: fit-content;
@@ -99,9 +128,7 @@ export const CheckBoxInput = ({
99
128
  isRequired,
100
129
  ...props
101
130
  }) => {
102
-
103
- const activeTheme = useTheme() || defaultThemeColor
104
-
131
+ const activeTheme = useTheme() || defaultThemeColor;
105
132
 
106
133
  useEffect(() => {
107
134
  filterCheckedOptions(options);
@@ -130,10 +157,8 @@ export const CheckBoxInput = ({
130
157
 
131
158
  return (
132
159
  <div style={returnedTarget} {...props}>
133
-
134
160
  <div style={{ display: 'flex' }}>
135
161
  <Label
136
- // themeColor={defaultThemeColor}
137
162
  customStyles={labelStyle}
138
163
  type={'check-label'}
139
164
  text={label}
@@ -194,10 +219,12 @@ export const CheckBoxInput = ({
194
219
  borderColor: item?.disabledColor,
195
220
  }}
196
221
  defaultBorderColor={defaultBorderColor}
222
+ theme={activeTheme}
197
223
  {...props}
198
224
  />
199
225
  )}
200
226
  <OptionText
227
+ theme={activeTheme}
201
228
  inline={inline}
202
229
  optionTextStyle={{
203
230
  ...optionTextStyle,
@@ -276,12 +303,12 @@ CheckBoxInput.propTypes = {
276
303
  */
277
304
  getCheckedArr: PropTypes.func,
278
305
  /**
279
- * mandatory field or not
280
- */
306
+ * mandatory field or not
307
+ */
281
308
  isRequired: PropTypes.bool,
282
309
  /**
283
- * Wrapper styles
284
- */
310
+ * Wrapper styles
311
+ */
285
312
  wrapperStyles: PropTypes.object,
286
313
  };
287
314
 
@@ -294,11 +321,6 @@ CheckBoxInput.defaultProps = {
294
321
  labelStyle: {},
295
322
  checkBoxOuterStyle: {},
296
323
  checkBoxInnerStyle: {},
297
- defaultTextColor: `${defaultThemeColor.neutral['neutral-2']}`,
298
- checkedTextColor: `${defaultThemeColor.neutral['neutral-1']}`,
299
- defaultBorderColor: `${defaultThemeColor.border
300
- }`,
301
- checkedCheckBoxColor: `${defaultThemeColor.primary['primary-1']} `,
302
324
  isRequired: true,
303
325
  wrapperStyles: {},
304
326
  };
@@ -171,25 +171,27 @@ const IconDiv = styled.div`
171
171
  `;
172
172
 
173
173
  export const DropdownSelect = ({
174
- customWrapperStyles,
175
- customLabelStyles,
176
- labelStyle,
177
174
  label,
178
- isRequired,
175
+ labelStyle,
179
176
  optionArr,
180
177
  selectedValue,
181
178
  setSelectedValue,
182
179
  placeHolder,
183
- dropdownType,
184
- isDisabled,
185
- isValid,
186
- clearSelected,
187
180
  isClearable,
188
- isLoading,
181
+ isValid,
189
182
  height,
190
183
  fontSize,
191
184
  loadOptions,
192
185
  onInputChange,
186
+ clearSelected,
187
+ customWrapperStyles,
188
+ customLabelStyles,
189
+ isRequired,
190
+ dropdownType,
191
+ isDisabled,
192
+
193
+ isLoading,
194
+
193
195
  ...props
194
196
  }) => {
195
197
 
@@ -198,7 +200,7 @@ export const DropdownSelect = ({
198
200
  const DropdownIndicator = (p) => {
199
201
  return (
200
202
  <components.DropdownIndicator {...p}>
201
- {true ? (
203
+ {isClearable ? (
202
204
  <IconDiv
203
205
  onClick={() => {
204
206
  clearSelected();
@@ -509,6 +511,43 @@ DropdownSelect.propTypes = {
509
511
  * onchange function
510
512
  */
511
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
+
512
551
  };
513
552
 
514
553
  DropdownSelect.defaultProps = {
@@ -525,4 +564,10 @@ DropdownSelect.defaultProps = {
525
564
  loadOptions: () => { },
526
565
  onInputChange: () => { },
527
566
  clearSelected: () => { },
567
+ customWrapperStyles: () => { },
568
+ customLabelStyles: () => { },
569
+ isRequired: false,
570
+ dropdownType: 'singleSelect',
571
+ isDisabled: false,
572
+ isLoading: false
528
573
  };