groundfloor-react-ui 1.2.9 → 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 +432 -422
  2. package/dist/index.js +444 -434
  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 -341
  130. package/components/Inputs/ColorInput.js +0 -145
  131. package/components/Inputs/DateSelect.js +0 -461
  132. package/components/Inputs/DropdownSelect.js +0 -689
  133. package/components/Inputs/DropzoneInput.js +0 -450
  134. package/components/Inputs/NumericInput.js +0 -177
  135. package/components/Inputs/PasswordInput.js +0 -267
  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 -251
  141. package/components/Inputs/TimeInput.js +0 -186
  142. package/components/Inputs/ToggleSwitch.js +0 -189
  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 -804
  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,251 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import styled, { css } 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
- ${({ textBoxStyle }) => textBoxStyle}
35
-
36
- background-color: ${({ isDisabled, theme }) =>
37
- isDisabled ? theme.variant['neutral-5'] : theme.bgColor}
38
- `;
39
-
40
- const Input = styled.input`
41
- width: 85%;
42
- //Set the styles from the default styles object
43
- ${({ inBuiltCss, defaultInputStyle }) => {
44
- return getDefaultStyles(inBuiltCss, defaultInputStyle);
45
- }}
46
-
47
- // custom styles
48
- ${({ inputStyle }) => inputStyle}
49
-
50
- .sc-furwcr bxRAoq {
51
- color: ${defaultThemeColor.variant['neutral-3']};
52
- }
53
- background-color: ${({ isDisabled, theme }) =>
54
- isDisabled ? theme.variant['neutral-5'] : theme.bgColor};
55
- `;
56
-
57
- const inline = css`
58
- display: flex;
59
- gap: 7px;
60
- align-items: center;
61
- `;
62
-
63
- const Form = styled.div`
64
- ${({ labelInline }) => (labelInline ? inline : null)}
65
- .err-text {
66
- color: ${({ errMsgColor }) => errMsgColor};
67
- margin-top: 5px;
68
- font-size: 10px;
69
- }
70
- `;
71
-
72
- Form.defaultProps = {
73
- theme: defaultThemeColor,
74
- };
75
-
76
- export const TextInput = ({
77
- textBoxStyle,
78
- labelStyle,
79
- inputStyle,
80
- errMsg,
81
- required,
82
- label,
83
- labelInline,
84
- iconBefore,
85
- iconAfter,
86
- isValid,
87
- type,
88
- theme,
89
- isDisabled,
90
- id,
91
- errMsgColor,
92
- ...props
93
- }) => {
94
- return (
95
- <Form
96
- labelInline={labelInline}
97
- {...props}
98
- theme={theme}
99
- errMsgColor={errMsgColor}
100
- >
101
- <div style={{ display: 'flex' }}>
102
- <Label
103
- customStyles={labelStyle}
104
- type={'label-text'}
105
- labelInline={labelInline}
106
- text={label}
107
- errMsg={errMsg}
108
- style={{
109
- display: 'flex',
110
- marginBottom: `${!labelInline ? '7px' : ''}`,
111
- paddingBottom: '0px',
112
- }}
113
- {...props}
114
- />
115
- {required && (
116
- <div
117
- style={{
118
- marginLeft: '4px',
119
- color: `${theme.variant['error']}`,
120
- }}
121
- >
122
- *
123
- </div>
124
- )}
125
- </div>
126
- <TextWrapper
127
- required={required}
128
- isDisabled={isDisabled}
129
- theme={theme}
130
- textBoxStyle={textBoxStyle}
131
- isValid={isValid}
132
- inBuiltCss={defaultStyles}
133
- defaultWrapperStyle={'textbox-wrapper'}
134
- {...props}
135
- >
136
- <div className='input-icon'>{iconBefore}</div>
137
- <Input
138
- inputStyle={inputStyle}
139
- type={type}
140
- theme={theme}
141
- id={id}
142
- defaultInputStyle={'input-wrapper'}
143
- isDisabled={isDisabled}
144
- disabled={isDisabled}
145
- {...props}
146
- />
147
- <div
148
- className='input-icon'
149
- style={{ position: 'absolute', right: '7px' }}
150
- >
151
- {iconAfter}
152
- </div>
153
- </TextWrapper>
154
- {errMsg.length > 0 && <div className='err-text'>{errMsg}</div>}
155
- </Form>
156
- );
157
- };
158
-
159
- TextInput.propTypes = {
160
- /**
161
- * Theme props of default in-built css
162
- */
163
- inBuiltCss: PropTypes.object,
164
- /**
165
- * Label of Input
166
- */
167
- label: PropTypes.string,
168
- /**
169
- * Is the input required?
170
- */
171
- required: PropTypes.bool,
172
- /**
173
- * Should label be inline with textbox?
174
- */
175
- labelInline: PropTypes.bool,
176
- /**
177
- * Error Message
178
- */
179
- errMsg: PropTypes.string,
180
- /**
181
- * Icon before input value
182
- */
183
- iconBefore: PropTypes.any,
184
- /**
185
- * Icon after input value
186
- */
187
- iconAfter: PropTypes.any,
188
- /**
189
- * custom style of textbox Wrapper
190
- */
191
- textBoxStyle: PropTypes.object,
192
- /**
193
- * custom style of textbox input
194
- */
195
- labelStyle: PropTypes.object,
196
- /**
197
- * custom style of textbox label
198
- */
199
- inputStyle: PropTypes.object,
200
- /**
201
- * input type i.e:- text, password
202
- */
203
- type: PropTypes.string,
204
- /**
205
- * input field disabled or not
206
- */
207
- isDisabled: PropTypes.bool,
208
- /**
209
- * receives theme object
210
- */
211
- theme: PropTypes.object,
212
- /**
213
- * id of the text input
214
- */
215
- id: PropTypes.string,
216
- /**
217
- * To customize the color of error message
218
- */
219
- errMsgColor: PropTypes.string,
220
- };
221
-
222
- Input.defaultProps = {
223
- theme: defaultThemeColor,
224
- };
225
-
226
- TextWrapper.defaultProps = {
227
- theme: defaultThemeColor,
228
- };
229
-
230
- Form.defaultProps = {
231
- theme: defaultThemeColor,
232
- };
233
-
234
- TextInput.defaultProps = {
235
- theme: defaultThemeColor,
236
- inBuiltCss: defaultStyles,
237
- label: '',
238
- required: false,
239
- isValid: true,
240
- labelInline: false,
241
- errMsg: '',
242
- iconBefore: null,
243
- iconAfter: null,
244
- textBoxStyle: {},
245
- labelStyle: {},
246
- inputStyle: {},
247
- type: 'text',
248
- isDisabled: false,
249
- id: '',
250
- errMsgColor: defaultThemeColor.variant['error'],
251
- };
@@ -1,186 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import styled, { css, useTheme } from 'styled-components';
4
- import defaultThemeColor from '../constants/defaultThemeColor';
5
-
6
- const TextBox = styled.div`
7
- color: #a9b1b8;
8
- font-size: 21px;
9
- border: 1px solid
10
- ${({ theme, isValid }) =>
11
- isValid ? defaultThemeColor.border : theme.variant['error']};
12
- border-radius: 4px;
13
- padding: 5px;
14
- display: inline-block;
15
- align-items: center;
16
- background-color: ${({ theme }) => theme.bgColor};
17
- &:focus-within {
18
- border: 1px solid ${({ theme }) => theme.variant['primary-1']};
19
- outline: none;
20
- }
21
- `;
22
-
23
- const Input = styled.input`
24
- border: 0;
25
- outline: 0;
26
- color: ${({ theme }) => theme.variant['primary-2']};
27
- margin: 0 5px;
28
- padding: 0;
29
- font-size: 21px;
30
- width: 24px;
31
- text-align:center;
32
- background-color: ${({ theme }) => theme.bgColor};
33
- `;
34
-
35
-
36
- const requiredAsterisk = css`
37
- &:after {
38
- content: ' *';
39
- color: ${({ theme }) => theme.variant['error']};
40
- }
41
- `;
42
-
43
- const Label = styled.label`
44
- display: block;
45
- margin-bottom: ${({ labelInline, errMsg }) =>
46
- labelInline && errMsg ? '18px' : '7px'};
47
- margin-right: ${({ labelInline }) => (labelInline ? '7px' : '')};
48
- color: ${({ theme }) => theme.variant['neutral-2']};
49
- ${({ required }) => (required ? requiredAsterisk : null)}
50
- padding-bottom: 0px;
51
- `;
52
-
53
-
54
-
55
- const inline = css`
56
- display: flex;
57
- align-items: center;
58
- `;
59
-
60
- const Form = styled.div`
61
- ${({ labelInline }) => (labelInline ? inline : null)}
62
- .err-text {
63
- color: ${({ theme }) => theme.variant['error']};
64
- margin-top: 5px;
65
- font-size: 10px;
66
- }
67
-
68
- > div {
69
- flex: 1 0 auto;
70
- }
71
- `;
72
-
73
-
74
- const Button = styled.button`
75
- border: none;
76
- outline: none;
77
- border-radius: 4px;
78
- background-color: ${({ theme }) => theme.bgColor};
79
- color: #444;
80
- padding: 5px 6px;
81
- font-size: 18px;
82
- cursor: pointer;
83
- `;
84
-
85
- export const TimeInput = ({
86
- label,
87
- errMsg,
88
- hour,
89
- minute,
90
- period,
91
- onChange,
92
- id,
93
- ...props
94
- }) => {
95
- const activeTheme = useTheme() || defaultThemeColor;
96
-
97
- function hourChange(evt) {
98
- const num =
99
- evt.currentTarget.value > 12
100
- ? 12
101
- : parseFloat(evt.currentTarget.value) || 0;
102
- onChange({ hour: num, minute, period });
103
- }
104
-
105
- function minuteChange(evt) {
106
- console.log('minute change', evt.currentTarget.value);
107
- const num =
108
- evt.currentTarget.value > 59
109
- ? 59
110
- : parseFloat(evt.currentTarget.value) || 0;
111
- onChange({ hour, minute: num, period });
112
- }
113
-
114
- function periodChange(evt) {
115
- const p = period === 'AM' ? 'PM' : 'AM';
116
- onChange({ hour, minute, period: p });
117
- }
118
-
119
- return (
120
- <Form theme={activeTheme} {...props}>
121
- <Label theme={activeTheme} {...props} errMsg={errMsg}>
122
- {label}
123
- </Label>
124
- <div>
125
- <TextBox theme={activeTheme} id={id} {...props}>
126
- <Input theme={activeTheme} value={hour} onChange={hourChange} />
127
- :
128
- <Input theme={activeTheme} value={minute} onChange={minuteChange} />
129
- <Button theme={activeTheme} onClick={periodChange}>{period}</Button>
130
- </TextBox>
131
- <div className='err-text'>{errMsg}</div>
132
- </div>
133
- </Form>
134
- );
135
- };
136
-
137
- TimeInput.propTypes = {
138
- /**
139
- * Label of Input
140
- */
141
- label: PropTypes.string,
142
- /**
143
- * Hour value
144
- */
145
- hour: PropTypes.number.isRequired,
146
- /**
147
- * Minute value
148
- */
149
- minute: PropTypes.number.isRequired,
150
- /**
151
- * AM or PM ?
152
- */
153
- period: PropTypes.string.isRequired,
154
- /**
155
- * Is the input required?
156
- */
157
- required: PropTypes.bool,
158
- /**
159
- * Should label be inline?
160
- */
161
- labelInline: PropTypes.bool,
162
- /**
163
- * Is the input correct?
164
- */
165
- isValid: PropTypes.bool,
166
- /**
167
- * Error Message
168
- */
169
- errMsg: PropTypes.string,
170
- /**
171
- * id of the time input
172
- */
173
- id: PropTypes.string,
174
- };
175
-
176
- TimeInput.defaultProps = {
177
- label: '',
178
- hour: 0,
179
- minute: 0,
180
- period: 'AM',
181
- required: false,
182
- labelInline: false,
183
- isValid: true,
184
- errMsg: '',
185
- id: ''
186
- };
@@ -1,189 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import styled, { useTheme } from 'styled-components';
3
- import defaultStyles from '../constants/defaultStyle';
4
- import defaultThemeColor from '../constants/defaultThemeColor';
5
- import getDefaultStyles from '../constants/utils';
6
-
7
- const CheckBoxWrapper = styled.div`
8
- ${({ inBuiltCss, defaultCheckBoxWrapperStyle }) => {
9
- return getDefaultStyles(inBuiltCss, defaultCheckBoxWrapperStyle);
10
- }}
11
- `;
12
- const CheckBoxLabel = styled.label`
13
-
14
- left: ${({ labelPosition }) => labelPosition === 'right' ? 'initial' : '50px'};
15
- margin-right: ${({ labelPosition }) => labelPosition === 'left' ? '30px' : '0px'};
16
-
17
-
18
- //Set the styles from the default styles object
19
- ${({ inBuiltCss, defaultCheckBoxLabelStyle }) => {
20
- return getDefaultStyles(inBuiltCss, defaultCheckBoxLabelStyle);
21
- }}
22
- background-color: ${({ checked, backgroundColor, disabledColor, theme }) => {
23
- if (checked && backgroundColor) return backgroundColor;
24
- else if (checked && !backgroundColor) return theme.primary['primary-1'];
25
- else if (!checked && disabledColor) return disabledColor;
26
- else if (!checked && !disabledColor) return theme.neutral['neutral-2'];
27
- }};
28
- // custom styles
29
- ${({ customToggleBoxStyle }) => customToggleBoxStyle}
30
- &:before {
31
- content: '';
32
- display: block;
33
- border-radius: 50%;
34
- width: 16px;
35
- height: 16px;
36
- margin-top: 3px;
37
- background: ${({ switchColor, theme }) =>
38
- switchColor ? switchColor : theme.bgColor};
39
- transition: 0.2s;
40
- margin-left: ${({ checked }) => (checked ? '4px' : '25px')};
41
-
42
- // custom styles
43
- ${({ customSwitchStyle }) => customSwitchStyle}
44
- }
45
- `;
46
-
47
- const CheckBox = styled.input.attrs({ type: 'checkbox' })`
48
- opacity: 0;
49
- z-index: 1;
50
- border-radius: 31px;
51
- width: 45px;
52
- height: 22px;
53
- cursor: pointer;
54
- position: ${({ labelPosition }) => labelPosition === 'right' ? 'initial' : 'absolute'};
55
- left: ${({ labelPosition }) => labelPosition === 'right' ? 'initial' : '50px'};
56
-
57
-
58
- `;
59
-
60
- const OptionText = styled.span`
61
-
62
- margin-right: ${({ labelPosition }) => labelPosition === 'right' ? '30px' : '30px'};
63
- z-index:10000;
64
- //Set the styles from the default styles object
65
- ${({ inBuiltCss, defaultOptionTextStyle }) => {
66
- return getDefaultStyles(inBuiltCss, defaultOptionTextStyle);
67
- }
68
- }
69
-
70
- // custom styles
71
- ${({ optionStyle }) => optionStyle}
72
- `;
73
-
74
- export const ToggleSwitch = ({
75
- checked,
76
- customSwitchStyle,
77
- customToggleBoxStyle,
78
- backgroundColor,
79
- disabledColor,
80
- switchColor,
81
- onClick,
82
- trueLabel,
83
- falseLabel,
84
- optionStyle,
85
- labelPosition,
86
- id,
87
- ...props
88
- }) => {
89
- const activeTheme = useTheme() || defaultThemeColor;
90
-
91
- return (
92
- <CheckBoxWrapper
93
- inBuiltCss={defaultStyles}
94
- defaultCheckBoxWrapperStyle={'toggle-switch-wrapper'}
95
- {...props}
96
- >
97
- {labelPosition === 'left' && <OptionText
98
- optionStyle={optionStyle}
99
- inBuiltCss={defaultStyles}
100
- labelPosition={labelPosition}
101
- defaultOptionTextStyle={'toggle-switch-option-text'}
102
- {...props}
103
- >
104
- {checked ? trueLabel : falseLabel}
105
- </OptionText>}
106
-
107
- <CheckBox
108
- {...props}
109
- labelPosition={labelPosition}
110
- id={id}
111
- inBuiltCss={defaultStyles}
112
- defaultCheckBoxStyle={'toggle-switch-checkbox'}
113
- onClick={() => {
114
- onClick(!checked);
115
- }}
116
- isChecked={checked}
117
- />
118
-
119
- <CheckBoxLabel
120
- {...props}
121
- labelPosition={labelPosition}
122
- htmlFor={id}
123
- customToggleBoxStyle={customToggleBoxStyle}
124
- customSwitchStyle={customSwitchStyle}
125
- disabledColor={disabledColor}
126
- backgroundColor={backgroundColor}
127
- switchColor={switchColor}
128
- inBuiltCss={defaultStyles}
129
- defaultCheckBoxLabelStyle={'toggle-switch-checkbox-label'}
130
- checked={checked}
131
- theme={activeTheme}
132
- />
133
- {labelPosition === 'right' && <OptionText
134
- optionStyle={optionStyle}
135
- inBuiltCss={defaultStyles}
136
- labelPosition={labelPosition}
137
- defaultOptionTextStyle={'toggle-switch-option-text'}
138
- {...props}
139
- >
140
- {checked ? trueLabel : falseLabel}
141
- </OptionText>}
142
- </CheckBoxWrapper>
143
- );
144
- };
145
-
146
- ToggleSwitch.propTypes = {
147
- /**
148
- * Custom styles for the toggleBox
149
- */
150
- customToggleBoxStyle: PropTypes.object,
151
- /**
152
- * Custom styles for the toggleSwitch
153
- */
154
- customSwitchStyle: PropTypes.object,
155
- /**
156
- * Type of color on background of toggleSwitch
157
- */
158
- backgroundColor: PropTypes.string,
159
- /**
160
- * default Toggle State
161
- */
162
- checked: PropTypes.bool,
163
- /**
164
- * label when toggle state is checked
165
- * */
166
- trueLabel: PropTypes.string,
167
- /**
168
- * label when toggle state is not checked
169
- * */
170
- falseLabel: PropTypes.string,
171
- /**
172
- * id of the Toggle switch
173
- */
174
- id: PropTypes.string,
175
- /**
176
- * label position i.e:- left or right
177
- */
178
- labelPosition: PropTypes.string
179
- };
180
-
181
- ToggleSwitch.defaultProps = {
182
- checked: false,
183
- trueLabel: 'Yes',
184
- falseLabel: 'No',
185
- customSwitchStyle: {},
186
- customToggleBoxStyle: {},
187
- id: '',
188
- labelPosition: 'right',
189
- };
@@ -1,15 +0,0 @@
1
- export * from './CheckBoxInput';
2
- export * from './ColorInput';
3
- export * from './DateSelect';
4
- export * from './DropdownSelect';
5
- export * from './DropzoneInput';
6
- export * from './NumericInput';
7
- export * from './PasswordInput';
8
- export * from './RadioInput';
9
- export * from './SearchInput';
10
- export * from './Signature';
11
- export * from './TextArea';
12
- export * from './TextInput';
13
- export * from './TimeInput';
14
- export * from './ToggleSwitch';
15
-
@@ -1,48 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import styled from 'styled-components';
4
- import defaultStyles from '../constants/defaultStyle';
5
- import defaultThemeColor from '../constants/defaultThemeColor';
6
- import getDefaultStyles from '../constants/utils';
7
-
8
- const LabelLayout = styled.label`
9
- //Set the styles from the default styles object
10
- ${({ theme, type }) => {
11
- return getDefaultStyles(theme, type);
12
- }}
13
-
14
- // custom styles
15
- ${({ customStyles }) => customStyles}
16
- `;
17
-
18
- export const Label = ({ customStyles, text, className, required, ...props }) => {
19
- const theme = defaultStyles;
20
- return (
21
- <LabelLayout required={required} theme={theme} customStyles={customStyles} type={'label'} {...props}>
22
- {text}
23
- {required && <div style={{
24
- marginLeft: '4px',
25
- color: `${defaultThemeColor.variant['error']}`
26
- }} >*</div>}
27
- </LabelLayout>
28
- )
29
- }
30
-
31
-
32
-
33
- Label.propTypes = {
34
- /**
35
- * Custom style object
36
- */
37
- customStyles: PropTypes.object,
38
- /**
39
- * Title Content
40
- */
41
- text: PropTypes.string,
42
- }
43
-
44
- Label.defaultProps = {
45
- text: ''
46
- }
47
-
48
-
@@ -1 +0,0 @@
1
- export * from './Label';