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