groundfloor-react-ui 1.0.0

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 (185) hide show
  1. package/README.md +20 -0
  2. package/assets/fonts/Averta/Averta-Black.woff2 +0 -0
  3. package/assets/fonts/Averta/Averta-BlackItalic.woff2 +0 -0
  4. package/assets/fonts/Averta/Averta-Bold.woff2 +0 -0
  5. package/assets/fonts/Averta/Averta-BoldItalic.woff2 +0 -0
  6. package/assets/fonts/Averta/Averta-ExtraBold.woff2 +0 -0
  7. package/assets/fonts/Averta/Averta-ExtraBoldItalic.woff2 +0 -0
  8. package/assets/fonts/Averta/Averta-ExtraThin.woff2 +0 -0
  9. package/assets/fonts/Averta/Averta-ExtraThinItalic.woff2 +0 -0
  10. package/assets/fonts/Averta/Averta-Light.woff2 +0 -0
  11. package/assets/fonts/Averta/Averta-LightItalic.woff2 +0 -0
  12. package/assets/fonts/Averta/Averta-Regular.woff2 +0 -0
  13. package/assets/fonts/Averta/Averta-RegularItalic.woff2 +0 -0
  14. package/assets/fonts/Averta/Averta-SemiBold.woff2 +0 -0
  15. package/assets/fonts/Averta/Averta-SemiBoldItalic.woff2 +0 -0
  16. package/assets/fonts/Averta/Averta-Thin.woff2 +0 -0
  17. package/assets/fonts/Averta/Averta-ThinItalic.woff2 +0 -0
  18. package/assets/fonts/Beauty/BeautyDemo.woff +0 -0
  19. package/assets/icons/app-logo.svg +3 -0
  20. package/assets/icons/arrow-down.svg +3 -0
  21. package/assets/icons/arrow-rotate.svg +1 -0
  22. package/assets/icons/arrow-up.svg +3 -0
  23. package/assets/icons/bell.svg +3 -0
  24. package/assets/icons/check.svg +3 -0
  25. package/assets/icons/checkmark.svg +3 -0
  26. package/assets/icons/chevron-down.svg +3 -0
  27. package/assets/icons/chevron-left.svg +3 -0
  28. package/assets/icons/chevron-right.svg +3 -0
  29. package/assets/icons/cloud-icon.svg +3 -0
  30. package/assets/icons/connection.svg +3 -0
  31. package/assets/icons/cross-icon.svg +3 -0
  32. package/assets/icons/door-internal-active.svg +1 -0
  33. package/assets/icons/edit-icon.svg +3 -0
  34. package/assets/icons/ellipses-horizontal.svg +3 -0
  35. package/assets/icons/ellipses.svg +3 -0
  36. package/assets/icons/email.svg +3 -0
  37. package/assets/icons/eye-hide-view.svg +1 -0
  38. package/assets/icons/eye-hide.svg +1 -0
  39. package/assets/icons/file-attach-white.svg +3 -0
  40. package/assets/icons/file-attach.svg +3 -0
  41. package/assets/icons/functional-equation-regular.svg +147 -0
  42. package/assets/icons/hamburger-menu.svg +3 -0
  43. package/assets/icons/heart.svg +18 -0
  44. package/assets/icons/image.svg +3 -0
  45. package/assets/icons/info.svg +3 -0
  46. package/assets/icons/jpg-icon.svg +3 -0
  47. package/assets/icons/magnifier.svg +3 -0
  48. package/assets/icons/menu-ellipse-two.svg +1 -0
  49. package/assets/icons/menu-ellipse.svg +53 -0
  50. package/assets/icons/pause-all.svg +1 -0
  51. package/assets/icons/pdf-icon.svg +3 -0
  52. package/assets/icons/pen-icon.svg +3 -0
  53. package/assets/icons/plus-outlined.svg +3 -0
  54. package/assets/icons/resume.svg +1 -0
  55. package/assets/icons/sign-icon.svg +3 -0
  56. package/assets/icons/star.svg +3 -0
  57. package/assets/icons/trash-icon.svg +59 -0
  58. package/assets/icons/triangle-down.svg +3 -0
  59. package/assets/icons/users.svg +11 -0
  60. package/assets/icons/view.svg +3 -0
  61. package/assets/icons/watcher.svg +3 -0
  62. package/assets/icons/zoom-in-white.svg +1 -0
  63. package/assets/styles/global.css +0 -0
  64. package/assets/styles/global.scss +0 -0
  65. package/components/Accordion/Accordion.js +114 -0
  66. package/components/Accordion/AccordionSB.js +168 -0
  67. package/components/Accordion/AccordionSBfooter.js +171 -0
  68. package/components/Accordion/index.js +4 -0
  69. package/components/ArrowBar/ArrowBar.js +293 -0
  70. package/components/ArrowBar/index.js +2 -0
  71. package/components/Avatar/Avatar.js +167 -0
  72. package/components/Avatar/AvatarSB.js +226 -0
  73. package/components/Avatar/AvatarSBfooter.js +226 -0
  74. package/components/Avatar/index.js +4 -0
  75. package/components/Banner/Banner.js +65 -0
  76. package/components/Banner/index.js +2 -0
  77. package/components/Breadcrumb/Breadcrumb.js +192 -0
  78. package/components/Breadcrumb/index.js +2 -0
  79. package/components/Button/PrimaryButton.js +125 -0
  80. package/components/Button/SecondaryButton.js +114 -0
  81. package/components/Button/TinyButton.js +94 -0
  82. package/components/Button/index.js +6 -0
  83. package/components/Cards/Card.js +48 -0
  84. package/components/Cards/CardRef.js +64 -0
  85. package/components/Cards/DocumentCard.js +221 -0
  86. package/components/Cards/index.js +5 -0
  87. package/components/Content/Content.js +51 -0
  88. package/components/Content/index.js +1 -0
  89. package/components/Divider/Divider.js +63 -0
  90. package/components/Divider/index.js +2 -0
  91. package/components/Drawer/Drawer.js +93 -0
  92. package/components/Drawer/index.js +2 -0
  93. package/components/ErrorBoundary/ErrorBoundary.js +44 -0
  94. package/components/ErrorBoundary/index.js +1 -0
  95. package/components/FilterChip/FilterChip.js +68 -0
  96. package/components/FilterChip/index.js +1 -0
  97. package/components/Footer/Footer.js +58 -0
  98. package/components/Footer/FooterContentLev3.js +96 -0
  99. package/components/Footer/index.js +2 -0
  100. package/components/Form/FormComponent.js +273 -0
  101. package/components/Form/HeaderComponent.js +39 -0
  102. package/components/Form/StyledComponent.js +323 -0
  103. package/components/Form/SubmitComponent.js +63 -0
  104. package/components/Form/index.js +4 -0
  105. package/components/GroupAvatars/GroupAvatars.js +143 -0
  106. package/components/GroupAvatars/index.js +1 -0
  107. package/components/GroupButtons/ButtonPopup.js +192 -0
  108. package/components/GroupButtons/GroupButtons.js +150 -0
  109. package/components/GroupButtons/GroupButtonsPopup.js +169 -0
  110. package/components/GroupButtons/index.js +3 -0
  111. package/components/GroupStatusCircle/GroupStatusCircle.js +135 -0
  112. package/components/GroupStatusCircle/index.js +1 -0
  113. package/components/Header/Header.js +58 -0
  114. package/components/Header/index.js +1 -0
  115. package/components/HyperLink/HyperLink.js +114 -0
  116. package/components/HyperLink/index.js +1 -0
  117. package/components/Icon/Icon.js +161 -0
  118. package/components/Icon/index.js +1 -0
  119. package/components/Images/Image.js +112 -0
  120. package/components/Images/index.js +2 -0
  121. package/components/Inputs/CheckBoxEditableInput.js +352 -0
  122. package/components/Inputs/CheckBoxInput.js +195 -0
  123. package/components/Inputs/CheckBoxInputMS.js +160 -0
  124. package/components/Inputs/DateSelect.js +411 -0
  125. package/components/Inputs/DropdownSelect.js +466 -0
  126. package/components/Inputs/DropzoneInput.js +335 -0
  127. package/components/Inputs/NumericInput.js +155 -0
  128. package/components/Inputs/RadioInput.js +205 -0
  129. package/components/Inputs/SearchInput.js +18 -0
  130. package/components/Inputs/Signature.js +278 -0
  131. package/components/Inputs/TextArea.js +196 -0
  132. package/components/Inputs/TextInput.js +182 -0
  133. package/components/Inputs/TextInputClicable.js +198 -0
  134. package/components/Inputs/TextInputClicableMS.js +255 -0
  135. package/components/Inputs/TimeInput.js +181 -0
  136. package/components/Inputs/ToggleSwitch.js +123 -0
  137. package/components/Inputs/index.js +13 -0
  138. package/components/Label/Label.js +48 -0
  139. package/components/Label/index.js +1 -0
  140. package/components/Loaders/Loader.js +179 -0
  141. package/components/Loaders/index.js +2 -0
  142. package/components/Modal/Modal.js +116 -0
  143. package/components/Modal/ModalComp.js +158 -0
  144. package/components/Modal/index.js +2 -0
  145. package/components/Overlay/Overlay.js +159 -0
  146. package/components/Overlay/index.js +1 -0
  147. package/components/Pagination/Pagination.js +83 -0
  148. package/components/Pagination/index.js +1 -0
  149. package/components/ProgressBar/ProgressBar.js +84 -0
  150. package/components/ProgressBar/index.js +1 -0
  151. package/components/ProgressSteps/ProgressSteps.js +121 -0
  152. package/components/ProgressSteps/index.js +1 -0
  153. package/components/Rating/Rating.js +264 -0
  154. package/components/Rating/index.js +1 -0
  155. package/components/SecondaryLink/DarkSecondaryLink.js +97 -0
  156. package/components/SecondaryLink/LightSecondaryLink.js +93 -0
  157. package/components/SecondaryLink/index.js +3 -0
  158. package/components/Sidebar/Navbar.js +328 -0
  159. package/components/Sidebar/Sidebar.js +180 -0
  160. package/components/Sidebar/index.js +3 -0
  161. package/components/StatusChip/PrimaryStatusChip.js +78 -0
  162. package/components/StatusChip/SecondaryStatusChip.js +78 -0
  163. package/components/StatusChip/SlimPrimaryStatusChip.js +92 -0
  164. package/components/StatusChip/SlimSecondaryStatusChip.js +93 -0
  165. package/components/StatusChip/index.js +6 -0
  166. package/components/StatusCircle/StatusCircle.js +64 -0
  167. package/components/StatusCircle/index.js +1 -0
  168. package/components/Tables/Table.js +156 -0
  169. package/components/Tables/index.js +1 -0
  170. package/components/Tooltip/Tooltip.js +479 -0
  171. package/components/Tooltip/index.js +1 -0
  172. package/components/Typography/Typography.js +78 -0
  173. package/components/Typography/index.js +2 -0
  174. package/components/constants/colors.js +33 -0
  175. package/components/constants/defaultStyle.js +781 -0
  176. package/components/constants/defaultThemeColor.js +15 -0
  177. package/components/constants/index.js +7 -0
  178. package/components/constants/utils.js +31 -0
  179. package/components/global/FontStyle.js +131 -0
  180. package/components/global/index.js +1 -0
  181. package/dist/index.es.js +2302 -0
  182. package/dist/index.js +2302 -0
  183. package/index.js +40 -0
  184. package/package.json +67 -0
  185. package/rollup.config.js +53 -0
@@ -0,0 +1,198 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled, { css, useTheme } from 'styled-components';
4
+ import defaultThemeColor from '../../constants/defaultThemeColor';
5
+
6
+ const border = `#D4D7E3`;
7
+
8
+ const TextBox = styled.div`
9
+ border: 1px solid ${({ theme, isValid }) => isValid ? border : theme.variant['error']};
10
+ border-radius: 4px;
11
+ padding: 8px 12px;
12
+ display: flex;
13
+ align-items: center;
14
+ position: relative;
15
+ z-index: 2;
16
+ cursor: pointer;
17
+
18
+ .input-icon svg path {
19
+ fill: ${({ theme }) => theme.variant['primary-2']};
20
+ }
21
+
22
+ &:focus-within {
23
+ border: 1px solid ${({ theme }) => theme.variant['primary-1']};
24
+ outline: none;
25
+
26
+ .input-icon svg path {
27
+ fill: ${({ theme, iconVariant }) => theme.variant[iconVariant]};
28
+ }
29
+ }
30
+ `;
31
+
32
+ TextBox.defaultProps = {
33
+ theme: defaultThemeColor,
34
+ }
35
+
36
+ const InputBorder = styled.div`
37
+ position: absolute;
38
+ top: calc(100% - 3px);
39
+ bottom: -2px;
40
+ left: 0;
41
+ right: 0;
42
+ z-index: 0;
43
+ border: 1px solid ${border};
44
+ border-top: none;
45
+ border-bottom: none;
46
+ visibility: ${({ menuIsOpen }) => menuIsOpen ? 'visible' : 'hidden'}
47
+ `
48
+
49
+ const Input = styled.input`
50
+ border: 0;
51
+ outline: 0;
52
+ color: ${({ theme }) => theme.variant['primary-2']};
53
+ margin: 0 5px;
54
+ padding: 0;
55
+ font-size: 14px;
56
+ flex-grow: 1;
57
+ flex-shrink: 0;
58
+ cursor: pointer;
59
+ white-space: nowrap;
60
+ overflow: hidden;
61
+ text-overflow: ellipsis;
62
+
63
+ ::placeholder {
64
+ color: ${({ theme, textValue }) => textValue ? theme.variant['primary-2'] : theme.variant['neutral-3']};
65
+ }
66
+ `;
67
+
68
+ Input.defaultProps = {
69
+ theme: defaultThemeColor,
70
+ }
71
+
72
+ const requiredAsterisk = css`
73
+ &:after {
74
+ content:" *";
75
+ color: ${({ theme }) => theme.variant['error']};
76
+ }
77
+ `
78
+
79
+ const Label = styled.label`
80
+ display: block;
81
+ margin-bottom: ${({ labelInline, errMsg }) => (labelInline && errMsg) ? '18px' : '8px'};
82
+ margin-right: ${({ labelInline }) => labelInline ? '10px' : ''};
83
+ color: ${({ theme }) => theme.variant['neutral-2']};
84
+ ${({ required }) => required ? requiredAsterisk : null}
85
+ `;
86
+
87
+ Label.defaultProps = {
88
+ theme: defaultThemeColor,
89
+ }
90
+
91
+ const inline = css`
92
+ display: flex;
93
+ align-items: center;
94
+ `
95
+
96
+ const Form = styled.div`
97
+ ${({ labelInline }) => labelInline ? inline : null}
98
+ .err-text {
99
+ color: ${({ theme }) => theme.variant['error']};
100
+ margin-top: 5px;
101
+ font-size: 10px;
102
+ }
103
+
104
+ > div {
105
+ flex: 1 0 auto;
106
+ }
107
+ `
108
+
109
+ Form.defaultProps = {
110
+ theme: defaultThemeColor,
111
+ }
112
+
113
+ const TextInputClicable = forwardRef(({ label, errMsg, iconBefore, iconAfter, onClick, onBlur, iconVariant, readonly, value, placeHolder, onChange, inputText, textValue, autofocusP, menuIsOpen, ...props }, ref) => {
114
+ const theme = useTheme() || defaultThemeColor;
115
+
116
+ return (
117
+ <Form {...props}>
118
+ <Label {...props} errMsg={errMsg} >
119
+ {label}
120
+ </Label>
121
+ <div ref={ref.refForm}>
122
+ <InputBorder menuIsOpen={menuIsOpen}></InputBorder>
123
+ <TextBox
124
+ {...props}
125
+ onClick={onClick}
126
+ >
127
+ <div className="input-icon">
128
+ {iconBefore}
129
+ </div>
130
+ <Input
131
+ {...props}
132
+ ref={ref.refInput}
133
+ readOnly={readonly}
134
+ onChange={onChange}
135
+ value={value}
136
+ placeholder={placeHolder}
137
+ textValue={textValue} //for styling
138
+ autoFocus={autofocusP}
139
+ menuIsOpen={menuIsOpen}
140
+ size='1'
141
+ />
142
+ <div className="input-icon">
143
+ {iconAfter}
144
+ </div>
145
+ </TextBox>
146
+ {!menuIsOpen && <div className='err-text'>{errMsg}</div>}
147
+ </div>
148
+ </Form>
149
+ )
150
+ })
151
+
152
+ TextInputClicable.propTypes = {
153
+ /**
154
+ * Theme props
155
+ */
156
+ theme: PropTypes.object,
157
+ /**
158
+ * Label of Input
159
+ */
160
+ label: PropTypes.string,
161
+ /**
162
+ * Is the input required?
163
+ */
164
+ required: PropTypes.bool,
165
+ /**
166
+ * Should label be inline?
167
+ */
168
+ labelInline: PropTypes.bool,
169
+ /**
170
+ * Is the input correct?
171
+ */
172
+ isValid: PropTypes.bool,
173
+ /**
174
+ * Error Message
175
+ */
176
+ errMsg: PropTypes.string,
177
+ /**
178
+ * Icon before input value
179
+ */
180
+ iconBefore: PropTypes.any,
181
+ /**
182
+ * Icon after input value
183
+ */
184
+ iconAfter: PropTypes.any,
185
+ }
186
+
187
+ TextInputClicable.defaultProps = {
188
+ theme: defaultThemeColor,
189
+ label: '',
190
+ required: false,
191
+ labelInline: false,
192
+ isValid: true,
193
+ errMsg: '',
194
+ iconBefore: null,
195
+ iconAfter: null,
196
+ }
197
+
198
+ export default TextInputClicable;
@@ -0,0 +1,255 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled, { css, useTheme } from 'styled-components';
4
+ import defaultThemeColor from '../../constants/defaultThemeColor';
5
+
6
+ const border = `#D4D7E3`;
7
+
8
+ const TextBox = styled.div`
9
+ border: 1px solid ${({ theme, isValid }) => isValid ? border : theme.variant['error']};
10
+ border-radius: 4px;
11
+ display: flex;
12
+ align-items: center;
13
+ position: relative;
14
+ z-index: 2;
15
+ cursor: pointer;
16
+
17
+
18
+
19
+ .input-icon svg path {
20
+ fill: ${({ theme }) => theme.variant['primary-2']};
21
+ }
22
+
23
+ &:focus-within {
24
+ border: 1px solid ${({ theme }) => theme.variant['primary-1']};
25
+ outline: none;
26
+
27
+ .input-icon svg path {
28
+ fill: ${({ theme, iconVariant }) => theme.variant[iconVariant]};
29
+ }
30
+ }
31
+ `;
32
+
33
+ const InputBorder = styled.div`
34
+ position: absolute;
35
+ top: calc(100% - 3px);
36
+ bottom: -2px;
37
+ left: 0;
38
+ right: 0;
39
+ z-index: 0;
40
+ border: 1px solid ${border};
41
+ border-top: none;
42
+ border-bottom: none;
43
+ visibility: ${({ menuIsOpen }) => menuIsOpen ? 'visible' : 'hidden'}
44
+ `
45
+
46
+
47
+ const Input = styled.input`
48
+ border: 0;
49
+ outline: 0;
50
+ color: ${({ theme }) => theme.variant['primary-2']};
51
+ margin: 0 5px;
52
+ padding: 8px 0 8px 12px;
53
+ font-size: 14px;
54
+ flex-grow: 1;
55
+ flex-shrink: 0;
56
+ cursor: ${({ isSearchable, menuIsOpen }) => !isSearchable ? 'pointer' : menuIsOpen ? 'input' : 'pointer'};
57
+ white-space: nowrap;
58
+ overflow: hidden;
59
+ text-overflow: ellipsis;
60
+
61
+ ::placeholder {
62
+ color: ${({ theme, textValue }) => textValue ? theme.variant['primary-2'] : theme.variant['neutral-3']};
63
+ }
64
+ `;
65
+
66
+ const requiredAsterisk = css`
67
+ &:after {
68
+ content:" *";
69
+ color: ${({ theme }) => theme.variant['error']};
70
+ }
71
+ `
72
+
73
+ const Label = styled.label`
74
+ display: block;
75
+ margin-bottom: ${({ labelInline, errMsg }) => (labelInline && errMsg) ? '18px' : '8px'};
76
+ margin-right: ${({ labelInline }) => labelInline ? '10px' : ''};
77
+ color: ${({ theme }) => theme.variant['neutral-2']};
78
+ ${({ required }) => required ? requiredAsterisk : null}
79
+ `;
80
+
81
+ const inline = css`
82
+ display: flex;
83
+ align-items: center;
84
+ `
85
+
86
+ const Form = styled.div`
87
+ ${({ labelInline }) => labelInline ? inline : null}
88
+ z-index: 1;
89
+ .err-text {
90
+ color: ${({ theme }) => theme.variant['error']};
91
+ margin-top: 5px;
92
+ font-size: 10px;
93
+ }
94
+
95
+ > div {
96
+ flex: 1 0 auto;
97
+ }
98
+ `
99
+
100
+ const StyledP = styled.p`
101
+ margin: 0 0 0 10px;
102
+ color: #6B747F;
103
+ white-space: nowrap;
104
+ cursor: ${({ isSearchable, menuIsOpen }) => !isSearchable ? 'pointer' : menuIsOpen ? 'default' : 'pointer'};
105
+ `
106
+
107
+ const TextInputClicableMS = forwardRef(({ isSearchable, qtySelected, label, errMsg, iconBefore, iconAfter, onClick, onBlur, iconVariant, readonly, value, placeHolder, onChange, inputText, textValue, autofocusP, menuIsOpen, ...props }, ref) => {
108
+ const theme = useTheme() || defaultThemeColor;
109
+
110
+ return (
111
+ <Form {...props}>
112
+ <Label {...props} errMsg={errMsg} >
113
+ {label}
114
+ </Label>
115
+ <div ref={ref.refForm}>
116
+ <InputBorder menuIsOpen={menuIsOpen}></InputBorder>
117
+ <TextBox
118
+ {...props}
119
+ onClick={!isSearchable ? onClick : menuIsOpen ? null : onClick} //if menu is close onClickon input open it. If open cannot close but type in it
120
+ >
121
+
122
+ <div className="input-icon">
123
+ {iconBefore}
124
+ </div>
125
+ <Input
126
+ {...props}
127
+ ref={ref.refInput}
128
+ readOnly={readonly}
129
+ onChange={onChange}
130
+ value={value}
131
+ placeholder={placeHolder}
132
+ textValue={textValue} //for styling
133
+ autoFocus={autofocusP}
134
+ menuIsOpen={menuIsOpen}
135
+ isSearchable={isSearchable}
136
+ size='1'
137
+ />
138
+ {qtySelected > 1 && <StyledP menuIsOpen={menuIsOpen} isSearchable={isSearchable} style={{}}>& {qtySelected - 1} more</StyledP>}
139
+ <div className="input-icon" onClick={onClick} style={{ padding: '10px 12px', alignSelf: 'stretch', alignItems: 'center', top: '0px', bottom: '0px', right: '0px', display: 'flex' }}>
140
+ {iconAfter}
141
+ </div>
142
+ </TextBox>
143
+ {!menuIsOpen && <div className='err-text'>{errMsg}</div>}
144
+ </div>
145
+ </Form>
146
+ )
147
+ })
148
+
149
+ TextBox.defaultProps = {
150
+ theme: defaultThemeColor,
151
+ }
152
+
153
+ Form.defaultProps = {
154
+ theme: defaultThemeColor,
155
+ }
156
+
157
+ Label.defaultProps = {
158
+ theme: defaultThemeColor,
159
+ }
160
+
161
+ Input.defaultProps = {
162
+ theme: defaultThemeColor,
163
+ }
164
+
165
+ TextInputClicableMS.propTypes = {
166
+ /**
167
+ * Theme props
168
+ */
169
+ theme: PropTypes.object,
170
+ /**
171
+ * Label of Input
172
+ */
173
+ label: PropTypes.string,
174
+ /**
175
+ * Is the input required?
176
+ */
177
+ required: PropTypes.bool,
178
+ /**
179
+ * Should label be inline?
180
+ */
181
+ labelInline: PropTypes.bool,
182
+ /**
183
+ * Is the input correct?
184
+ */
185
+ isValid: PropTypes.bool,
186
+ /**
187
+ * Error Message
188
+ */
189
+ errMsg: PropTypes.string,
190
+ /**
191
+ * Icon before input value
192
+ */
193
+ iconBefore: PropTypes.any,
194
+ /**
195
+ * Icon after input value
196
+ */
197
+ iconAfter: PropTypes.any,
198
+ /**
199
+ * Boolean to enable disable pointer style
200
+ */
201
+ isSearchable: PropTypes.bool,
202
+ /**
203
+ * Value of the item selected when > 1
204
+ */
205
+ qtySelected: PropTypes.number,
206
+ /**
207
+ * Click handler
208
+ */
209
+ onClick: PropTypes.func,
210
+ /**
211
+ * Icon color
212
+ */
213
+ iconVariant: PropTypes.string,
214
+ /**
215
+ * Make input not editable
216
+ */
217
+ readonly: PropTypes.bool,
218
+ /**
219
+ * Value of the input
220
+ */
221
+ value: PropTypes.string,
222
+ /**
223
+ * Placeholder of the input
224
+ */
225
+ placeHolder: PropTypes.string,
226
+ /**
227
+ * Change handler
228
+ */
229
+ onChange: PropTypes.func,
230
+ /**
231
+ * Apply different style to the place holder
232
+ */
233
+ textValue: PropTypes.string,
234
+ /**
235
+ * Autofocus the input
236
+ */
237
+ autofocusP: PropTypes.bool,
238
+ /**
239
+ * Apply different style
240
+ */
241
+ menuIsOpen: PropTypes.bool,
242
+ }
243
+
244
+ TextInputClicableMS.defaultProps = {
245
+ theme: defaultThemeColor,
246
+ label: '',
247
+ required: false,
248
+ labelInline: false,
249
+ isValid: true,
250
+ errMsg: '',
251
+ iconBefore: null,
252
+ iconAfter: null,
253
+ }
254
+
255
+ export default TextInputClicableMS;
@@ -0,0 +1,181 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled, { css, useTheme } from 'styled-components';
4
+ import defaultThemeColor from '../constants/defaultThemeColor';
5
+
6
+ const border = `#D4D7E3`;
7
+
8
+ const TextBox = styled.div`
9
+ color: #A9B1B8;
10
+ font-size: 21px;
11
+ border: 1px solid ${({ theme, isValid }) => isValid ? border : theme.variant['error']};
12
+ border-radius: 4px;
13
+ padding: 5px;
14
+ display: inline-block;
15
+ align-items: center;
16
+
17
+ &:focus-within {
18
+ border: 1px solid ${({ theme }) => theme.variant['primary-1']};
19
+ outline: none;
20
+ }
21
+ `;
22
+
23
+ TextBox.defaultProps = {
24
+ theme: defaultThemeColor,
25
+ }
26
+
27
+ const Input = styled.input`
28
+ border: 0;
29
+ outline: 0;
30
+ color: ${({ theme }) => theme.variant['primary-2']};
31
+ margin: 0 5px;
32
+ padding: 0;
33
+ font-size: 21px;
34
+ width: 24px;
35
+ `;
36
+
37
+ Input.defaultProps = {
38
+ theme: defaultThemeColor,
39
+ }
40
+
41
+ const requiredAsterisk = css`
42
+ &:after {
43
+ content:" *";
44
+ color: ${({ theme }) => theme.variant['error']};
45
+ }
46
+ `
47
+
48
+ const Label = styled.label`
49
+ display: block;
50
+ margin-bottom: ${({ labelInline, errMsg }) => (labelInline && errMsg) ? '18px' : '8px'};
51
+ margin-right: ${({ labelInline }) => labelInline ? '10px' : ''};
52
+ color: ${({ theme }) => theme.variant['neutral-2']};
53
+ ${({ required }) => required ? requiredAsterisk : null}
54
+ `;
55
+
56
+ Label.defaultProps = {
57
+ theme: defaultThemeColor,
58
+ }
59
+
60
+ const inline = css`
61
+ display: flex;
62
+ align-items: center;
63
+ `
64
+
65
+ const Form = styled.div`
66
+ ${({ labelInline }) => labelInline ? inline : null}
67
+ .err-text {
68
+ color: ${({ theme }) => theme.variant['error']};
69
+ margin-top: 5px;
70
+ font-size: 10px;
71
+ }
72
+
73
+ > div {
74
+ flex: 1 0 auto;
75
+ }
76
+ `
77
+
78
+ Form.defaultProps = {
79
+ theme: defaultThemeColor,
80
+ }
81
+
82
+ const Button = styled.button`
83
+ border: none;
84
+ outline: none;
85
+ border-radius: 4px;
86
+ background-color: #F2F4FE;
87
+ color: #444;
88
+ padding: 5px 6px;
89
+ font-size: 18px;
90
+ cursor: pointer;
91
+ `;
92
+
93
+ Button.defaultProps = {
94
+ theme: defaultThemeColor,
95
+ }
96
+
97
+ export const TimeInput = ({ label, errMsg, hour, minute, period, onChange, ...props }) => {
98
+ const theme = useTheme() || defaultThemeColor;
99
+
100
+ function hourChange(evt) {
101
+ const num = evt.currentTarget.value>12? 12: 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 = evt.currentTarget.value>59?59: parseFloat(evt.currentTarget.value) || 0;
108
+ onChange({ hour, minute: num, period });
109
+ }
110
+
111
+ function periodChange(evt) {
112
+ const p = period === 'AM' ? 'PM' : 'AM'
113
+ onChange({ hour, minute, period: p });
114
+ }
115
+
116
+ return (
117
+ <Form {...props}>
118
+ <Label {...props} errMsg={errMsg} >
119
+ {label}
120
+ </Label>
121
+ <div>
122
+ <TextBox
123
+ {...props}
124
+ >
125
+ <Input value={hour} onChange={hourChange} />
126
+ :
127
+ <Input value={minute} onChange={minuteChange} />
128
+ <Button onClick={periodChange} >{period}</Button>
129
+ </TextBox>
130
+ <div className='err-text'>{errMsg}</div>
131
+ </div>
132
+ </Form>
133
+ )
134
+ }
135
+
136
+ TimeInput.propTypes = {
137
+ /**
138
+ * Label of Input
139
+ */
140
+ label: PropTypes.string,
141
+ /**
142
+ * Hour value
143
+ */
144
+ hour: PropTypes.number.isRequired,
145
+ /**
146
+ * Minute value
147
+ */
148
+ minute: PropTypes.number.isRequired,
149
+ /**
150
+ * AM or PM ?
151
+ */
152
+ period: PropTypes.string.isRequired,
153
+ /**
154
+ * Is the input required?
155
+ */
156
+ required: PropTypes.bool,
157
+ /**
158
+ * Should label be inline?
159
+ */
160
+ labelInline: PropTypes.bool,
161
+ /**
162
+ * Is the input correct?
163
+ */
164
+ isValid: PropTypes.bool,
165
+ /**
166
+ * Error Message
167
+ */
168
+ errMsg: PropTypes.string,
169
+ }
170
+
171
+ TimeInput.defaultProps = {
172
+ label: '',
173
+ hour: 0,
174
+ minute: 0,
175
+ period: 'AM',
176
+ required: false,
177
+ labelInline: false,
178
+ isValid: true,
179
+ errMsg: '',
180
+ }
181
+