groundfloor-react-ui 1.2.4 → 1.2.5

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,4 +1,3 @@
1
- import React from 'react';
2
1
  import styled from "styled-components";
3
2
 
4
3
  export const PageContent = styled.div`
@@ -310,24 +309,4 @@ export const MultiColumnDiv = styled.div`
310
309
  max-width: 48%;
311
310
  min-width: 48%;
312
311
 
313
- `;
314
-
315
-
316
-
317
-
318
- export const FormWrapper = ({ customStyles }) => {
319
-
320
- const Wrapper = styled.form`
321
- width: 40vw;
322
- display: flex;
323
- justify-content: center;
324
- flex-direction: column;
325
- gap: 20px;
326
- ${({ customStyles }) => customStyles}
327
- `;
328
- return (
329
- <Wrapper customStyles={customStyles}>
330
- </Wrapper>
331
- );
332
- };
333
-
312
+ `;
@@ -3,7 +3,7 @@ import { PrimaryButton, SecondaryButton, TinyButton } from '../Button';
3
3
  import defaultThemeColor from '../constants/defaultThemeColor';
4
4
  import {
5
5
  FormContainer,
6
- FormWrapper, MultiColumnDiv, MultiColumnWrapper
6
+ MultiColumnDiv, MultiColumnWrapper
7
7
  } from '../DesignComponent';
8
8
  import { Header } from '../Header';
9
9
  import {
@@ -23,9 +23,11 @@ import {
23
23
  import { Label } from '../Label';
24
24
  import { Rating } from '../Rating';
25
25
  import { Table } from '../Tables';
26
+ import { FormWrapper } from './FormWrapper';
26
27
  import { HeaderComponent } from './HeaderComponent';
27
28
 
28
- export const FormComponent = ({ formData, ...props }) => {
29
+
30
+ export const FormComponent = ({ formData, customStyles, ...props }) => {
29
31
  const header = (item) => {
30
32
  return (
31
33
  <Fragment>
@@ -211,8 +213,8 @@ export const FormComponent = ({ formData, ...props }) => {
211
213
 
212
214
  return (
213
215
  <Fragment>
214
- <FormContainer defaultThemeColor={defaultThemeColor} >
215
- <FormWrapper onSubmit={handleSubmit} >
216
+ <FormContainer defaultThemeColor={defaultThemeColor}>
217
+ <FormWrapper onSubmit={handleSubmit} customStyles={customStyles} >
216
218
  {formData.map((row, i) => {
217
219
  if (row.length > 1) {
218
220
  return (
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ const Wrapper = styled.form`
5
+ width: 40vw;
6
+ display: flex;
7
+ justify-content: center;
8
+ flex-direction: column;
9
+ gap: 20px;
10
+ ${({ customStyles }) => customStyles}
11
+ `;
12
+
13
+ export const FormWrapper = ({ customStyles }) => {
14
+ return <Wrapper customStyles={customStyles}></Wrapper>;
15
+ };
@@ -1,4 +1,6 @@
1
1
  export * from './FormComponent';
2
+ export * from './FormWrapper';
2
3
  export * from './HeaderComponent';
3
4
  export * from './SubmitComponent';
4
5
 
6
+
@@ -118,11 +118,18 @@ const Wrapper = styled.div`
118
118
  color:${({ theme }) => theme.textColor} !important;
119
119
  margin-right: 0px;
120
120
  }
121
+ .text-main-alt-value {
122
+ color:${({ theme }) => theme.textColor} !important;
123
+ white-space: nowrap;
124
+ overflow: hidden;
125
+ text-overflow: ellipsis;
126
+
127
+ }
121
128
  .text-more-alt{
122
129
  font-size:12px;
123
130
  color: ${({ theme }) => theme.neutral['neutral-2']};
124
131
  padding-right: 0px;
125
- margin-right: 0px;
132
+
126
133
 
127
134
  }
128
135
  .css-mohuvp-dummyInput-DummyInput{
@@ -252,20 +259,12 @@ export const DropdownSelect = ({
252
259
  )}
253
260
 
254
261
  {children}
255
- {len > 1 && <div className={`text-more-alt`}>&amp; {len - 1} more</div>}
262
+ {len > 1 && <span className={`text-more-alt`}>&amp; {len - 1} more</span>}
256
263
  </components.ValueContainer>
257
264
  );
258
265
  };
259
266
 
260
- const ValueContainer = ({ getValue, children, ...props }) => {
261
- const len = getValue().length;
262
- return (
263
- <components.ValueContainer {...props}>
264
- {children}
265
- {len > 1 && <div className={`text-more-alt`}>&amp; {len - 1} more</div>}
266
- </components.ValueContainer>
267
- );
268
- };
267
+
269
268
 
270
269
  const Option = (p) => {
271
270
  const checkboxStyle = {
@@ -312,7 +311,7 @@ export const DropdownSelect = ({
312
311
 
313
312
  const MultiValue = ({ index, ...p }) => {
314
313
  const firstSelected = p?.data?.label || 'Select';
315
- return !index && <div className='text-main-alt'>{firstSelected}</div>;
314
+ return !index && <span className='text-main-alt-value'>{firstSelected}</span>;
316
315
  };
317
316
 
318
317
  const stylesComp = {
@@ -321,7 +320,7 @@ export const DropdownSelect = ({
321
320
  border: !isValid
322
321
  ? '1px solid ' + activeTheme.ui['error']
323
322
  : '1px solid ' + activeTheme.border,
324
- minWidth: '215px',
323
+ minWidth: '226px',
325
324
  height: `${height}px`,
326
325
  minHeight: `${height}px`,
327
326
  boxShadow: (state.isSelected || state.isFocused) && 'none',
@@ -350,6 +349,7 @@ export const DropdownSelect = ({
350
349
  valueContainer: (base) => ({
351
350
  ...base,
352
351
  display: 'flex',
352
+ justifyContent: 'space-between',
353
353
  fontSize: fontSize + 'px',
354
354
  }),
355
355
  indicatorsContainer: (base) => ({
@@ -368,6 +368,7 @@ export const DropdownSelect = ({
368
368
  borderRadius: '4.32px',
369
369
  fontSize: fontSize + 'px',
370
370
  width: '100%',
371
+ minWidth: '226px',
371
372
  }),
372
373
  singleValue: (base) => ({
373
374
  ...base,
@@ -652,6 +653,9 @@ DropdownSelect.propTypes = {
652
653
  * iconSize of the select
653
654
  */
654
655
  leftIconSize: PropTypes.number,
656
+ /**
657
+ * to show or hide indicator
658
+ */
655
659
  showIndicator: PropTypes.bool,
656
660
  };
657
661
 
@@ -679,7 +683,7 @@ DropdownSelect.defaultProps = {
679
683
  iconName: 'triangle-down',
680
684
  iconColor: 'black',
681
685
  iconSize: 8,
682
- leftIcon: 'magnifier-icon',
686
+ leftIcon: '',
683
687
  leftIconColor: 'black',
684
688
  leftIconSize: 10,
685
689
  showIndicator: true,
@@ -7,26 +7,6 @@ import defaultThemeColor from '../constants/defaultThemeColor';
7
7
  import getDefaultStyles from '../constants/utils';
8
8
  import { Icon } from '../Icon';
9
9
 
10
- const customStyles = {
11
- overlay: {
12
- zIndex: '999999',
13
- backgroundColor: 'rgb(0 0 0 / 30%)'
14
- },
15
- content: {
16
- borderColor: defaultThemeColor.border,
17
- top: '50%',
18
- left: '50%',
19
- right: 'auto',
20
- bottom: 'auto',
21
- marginRight: '-50%',
22
- padding: '0px',
23
- transform: 'translate(-50%, -50%)',
24
- minWidth: '40vw',
25
- maxHeight: '85vh',
26
- overflow: 'hidden',
27
- },
28
- };
29
-
30
10
  const ModalClose = styled.button`
31
11
  //Set the styles from the default styles object
32
12
  ${({ theme, type }) => {
@@ -35,29 +15,19 @@ const ModalClose = styled.button`
35
15
  // custom styles
36
16
  ${({ customModalCloseStyle }) => customModalCloseStyle}
37
17
  //Set the styles from the default styles object
38
- &:focus{
39
- outline: none;
40
- border: none;
41
- }
18
+ &:focus {
19
+ outline: none;
20
+ border: none;
21
+ }
42
22
  `;
43
23
 
44
24
  const ModalHeader = styled.div`
45
- .header-title {
46
- display: flex;
47
- gap: 10px;
48
- align-items: center;
49
- }
50
- .header-description {
51
- margin-top: 5px;
52
- }
53
- h4 {
54
- margin-bottom: 0;
55
- }
25
+ margin-top: 10px;
26
+
56
27
  // custom styles
57
28
  ${({ customModalHeaderStyle }) => customModalHeaderStyle}
58
29
  `;
59
30
  const ModalBody = styled.div`
60
-
61
31
  //Set the styles from the default styles object
62
32
  ${({ theme, type }) => {
63
33
  return getDefaultStyles(theme, type);
@@ -69,7 +39,7 @@ const ModalBody = styled.div`
69
39
  const ContentWrapper = styled.div`
70
40
  max-height: 60vh;
71
41
  overflow-y: auto;
72
- `
42
+ `;
73
43
 
74
44
  const ModalFooter = styled.div`
75
45
  //Set the styles from the default styles object
@@ -81,27 +51,23 @@ const ModalFooter = styled.div`
81
51
  `;
82
52
 
83
53
  const CommonDiv = styled.div`
84
- padding: .5rem 3rem 0rem 3rem;
54
+ padding: 0.5rem 3rem 0rem 3rem;
85
55
  `;
86
56
 
87
57
  const HeaderWrapper = styled.div`
88
58
  position: sticky;
89
- background-color: ${({ theme }) => theme.bgColor};
90
- width: 100%;
59
+ background-color: ${({ theme }) => theme.bgColor};
60
+ width: 100%;
91
61
  top: 0px;
92
- border-bottom: 1px solid ${({ theme }) => theme.border}
93
-
94
- `
95
-
62
+ border-bottom: 1px solid ${({ theme }) => theme.border};
63
+ `;
96
64
 
97
65
  try {
98
- Modal.setAppElement('#root')
99
-
66
+ Modal.setAppElement('#root');
100
67
  } catch (error) {
101
- Modal.setAppElement('#__next')
68
+ Modal.setAppElement('#__next');
102
69
  }
103
70
 
104
-
105
71
  export const ModalComp = ({
106
72
  modalIsOpen,
107
73
  toggleModal,
@@ -113,10 +79,35 @@ export const ModalComp = ({
113
79
  customModalHeaderStyle,
114
80
  customModalBodyStyle,
115
81
  customModalFooterStyle,
82
+ customWidth,
83
+ customMinWidth,
84
+ customMaxWidth,
116
85
  ...props
117
86
  }) => {
118
87
  const activeTheme = useTheme() || defaultThemeColor;
119
88
 
89
+ const customStyles = {
90
+ overlay: {
91
+ zIndex: '999999',
92
+ backgroundColor: 'rgb(0 0 0 / 30%)',
93
+ },
94
+ content: {
95
+ borderColor: defaultThemeColor.border,
96
+ top: '50%',
97
+ left: '50%',
98
+ right: 'auto',
99
+ bottom: 'auto',
100
+ marginRight: '-50%',
101
+ padding: '0px',
102
+ transform: 'translate(-50%, -50%)',
103
+ minWidth: customMinWidth,
104
+ maxHeight: '85vh',
105
+ overflow: 'hidden',
106
+ width: customWidth && customWidth,
107
+ maxWidth: customMaxWidth && customMaxWidth,
108
+ },
109
+ };
110
+
120
111
  return (
121
112
  <Modal
122
113
  isOpen={modalIsOpen}
@@ -149,8 +140,7 @@ export const ModalComp = ({
149
140
  type={'modalComp-modal-body'}
150
141
  style={customModalBodyStyle}
151
142
  >
152
- <CommonDiv> {bodyContent}
153
- </CommonDiv>
143
+ <CommonDiv> {bodyContent}</CommonDiv>
154
144
  </ModalBody>
155
145
 
156
146
  <ModalFooter
@@ -206,6 +196,7 @@ ModalComp.propTypes = {
206
196
  * Modal Footer custom styles
207
197
  */
208
198
  customModalFooterStyle: PropTypes.object,
199
+ customMinWidth: PropTypes.string,
209
200
  };
210
201
 
211
202
  ModalComp.defaultProps = {
@@ -219,4 +210,7 @@ ModalComp.defaultProps = {
219
210
  customModalHeaderStyle: {},
220
211
  customModalBodyStyle: {},
221
212
  customModalFooterStyle: {},
213
+ customMinWidth: '40vw',
214
+ customWidth: '',
215
+ customMaxWidth: '',
222
216
  };