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.
- package/README.md +20 -0
- package/assets/fonts/Averta/Averta-Black.woff2 +0 -0
- package/assets/fonts/Averta/Averta-BlackItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Bold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-BoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraBold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraBoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraThin.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ExtraThinItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Light.woff2 +0 -0
- package/assets/fonts/Averta/Averta-LightItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Regular.woff2 +0 -0
- package/assets/fonts/Averta/Averta-RegularItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-SemiBold.woff2 +0 -0
- package/assets/fonts/Averta/Averta-SemiBoldItalic.woff2 +0 -0
- package/assets/fonts/Averta/Averta-Thin.woff2 +0 -0
- package/assets/fonts/Averta/Averta-ThinItalic.woff2 +0 -0
- package/assets/fonts/Beauty/BeautyDemo.woff +0 -0
- package/assets/icons/app-logo.svg +3 -0
- package/assets/icons/arrow-down.svg +3 -0
- package/assets/icons/arrow-rotate.svg +1 -0
- package/assets/icons/arrow-up.svg +3 -0
- package/assets/icons/bell.svg +3 -0
- package/assets/icons/check.svg +3 -0
- package/assets/icons/checkmark.svg +3 -0
- package/assets/icons/chevron-down.svg +3 -0
- package/assets/icons/chevron-left.svg +3 -0
- package/assets/icons/chevron-right.svg +3 -0
- package/assets/icons/cloud-icon.svg +3 -0
- package/assets/icons/connection.svg +3 -0
- package/assets/icons/cross-icon.svg +3 -0
- package/assets/icons/door-internal-active.svg +1 -0
- package/assets/icons/edit-icon.svg +3 -0
- package/assets/icons/ellipses-horizontal.svg +3 -0
- package/assets/icons/ellipses.svg +3 -0
- package/assets/icons/email.svg +3 -0
- package/assets/icons/eye-hide-view.svg +1 -0
- package/assets/icons/eye-hide.svg +1 -0
- package/assets/icons/file-attach-white.svg +3 -0
- package/assets/icons/file-attach.svg +3 -0
- package/assets/icons/functional-equation-regular.svg +147 -0
- package/assets/icons/hamburger-menu.svg +3 -0
- package/assets/icons/heart.svg +18 -0
- package/assets/icons/image.svg +3 -0
- package/assets/icons/info.svg +3 -0
- package/assets/icons/jpg-icon.svg +3 -0
- package/assets/icons/magnifier.svg +3 -0
- package/assets/icons/menu-ellipse-two.svg +1 -0
- package/assets/icons/menu-ellipse.svg +53 -0
- package/assets/icons/pause-all.svg +1 -0
- package/assets/icons/pdf-icon.svg +3 -0
- package/assets/icons/pen-icon.svg +3 -0
- package/assets/icons/plus-outlined.svg +3 -0
- package/assets/icons/resume.svg +1 -0
- package/assets/icons/sign-icon.svg +3 -0
- package/assets/icons/star.svg +3 -0
- package/assets/icons/trash-icon.svg +59 -0
- package/assets/icons/triangle-down.svg +3 -0
- package/assets/icons/users.svg +11 -0
- package/assets/icons/view.svg +3 -0
- package/assets/icons/watcher.svg +3 -0
- package/assets/icons/zoom-in-white.svg +1 -0
- package/assets/styles/global.css +0 -0
- package/assets/styles/global.scss +0 -0
- package/components/Accordion/Accordion.js +114 -0
- package/components/Accordion/AccordionSB.js +168 -0
- package/components/Accordion/AccordionSBfooter.js +171 -0
- package/components/Accordion/index.js +4 -0
- package/components/ArrowBar/ArrowBar.js +293 -0
- package/components/ArrowBar/index.js +2 -0
- package/components/Avatar/Avatar.js +167 -0
- package/components/Avatar/AvatarSB.js +226 -0
- package/components/Avatar/AvatarSBfooter.js +226 -0
- package/components/Avatar/index.js +4 -0
- package/components/Banner/Banner.js +65 -0
- package/components/Banner/index.js +2 -0
- package/components/Breadcrumb/Breadcrumb.js +192 -0
- package/components/Breadcrumb/index.js +2 -0
- package/components/Button/PrimaryButton.js +125 -0
- package/components/Button/SecondaryButton.js +114 -0
- package/components/Button/TinyButton.js +94 -0
- package/components/Button/index.js +6 -0
- package/components/Cards/Card.js +48 -0
- package/components/Cards/CardRef.js +64 -0
- package/components/Cards/DocumentCard.js +221 -0
- package/components/Cards/index.js +5 -0
- package/components/Content/Content.js +51 -0
- package/components/Content/index.js +1 -0
- package/components/Divider/Divider.js +63 -0
- package/components/Divider/index.js +2 -0
- package/components/Drawer/Drawer.js +93 -0
- package/components/Drawer/index.js +2 -0
- package/components/ErrorBoundary/ErrorBoundary.js +44 -0
- package/components/ErrorBoundary/index.js +1 -0
- package/components/FilterChip/FilterChip.js +68 -0
- package/components/FilterChip/index.js +1 -0
- package/components/Footer/Footer.js +58 -0
- package/components/Footer/FooterContentLev3.js +96 -0
- package/components/Footer/index.js +2 -0
- package/components/Form/FormComponent.js +273 -0
- package/components/Form/HeaderComponent.js +39 -0
- package/components/Form/StyledComponent.js +323 -0
- package/components/Form/SubmitComponent.js +63 -0
- package/components/Form/index.js +4 -0
- package/components/GroupAvatars/GroupAvatars.js +143 -0
- package/components/GroupAvatars/index.js +1 -0
- package/components/GroupButtons/ButtonPopup.js +192 -0
- package/components/GroupButtons/GroupButtons.js +150 -0
- package/components/GroupButtons/GroupButtonsPopup.js +169 -0
- package/components/GroupButtons/index.js +3 -0
- package/components/GroupStatusCircle/GroupStatusCircle.js +135 -0
- package/components/GroupStatusCircle/index.js +1 -0
- package/components/Header/Header.js +58 -0
- package/components/Header/index.js +1 -0
- package/components/HyperLink/HyperLink.js +114 -0
- package/components/HyperLink/index.js +1 -0
- package/components/Icon/Icon.js +161 -0
- package/components/Icon/index.js +1 -0
- package/components/Images/Image.js +112 -0
- package/components/Images/index.js +2 -0
- package/components/Inputs/CheckBoxEditableInput.js +352 -0
- package/components/Inputs/CheckBoxInput.js +195 -0
- package/components/Inputs/CheckBoxInputMS.js +160 -0
- package/components/Inputs/DateSelect.js +411 -0
- package/components/Inputs/DropdownSelect.js +466 -0
- package/components/Inputs/DropzoneInput.js +335 -0
- package/components/Inputs/NumericInput.js +155 -0
- package/components/Inputs/RadioInput.js +205 -0
- package/components/Inputs/SearchInput.js +18 -0
- package/components/Inputs/Signature.js +278 -0
- package/components/Inputs/TextArea.js +196 -0
- package/components/Inputs/TextInput.js +182 -0
- package/components/Inputs/TextInputClicable.js +198 -0
- package/components/Inputs/TextInputClicableMS.js +255 -0
- package/components/Inputs/TimeInput.js +181 -0
- package/components/Inputs/ToggleSwitch.js +123 -0
- package/components/Inputs/index.js +13 -0
- package/components/Label/Label.js +48 -0
- package/components/Label/index.js +1 -0
- package/components/Loaders/Loader.js +179 -0
- package/components/Loaders/index.js +2 -0
- package/components/Modal/Modal.js +116 -0
- package/components/Modal/ModalComp.js +158 -0
- package/components/Modal/index.js +2 -0
- package/components/Overlay/Overlay.js +159 -0
- package/components/Overlay/index.js +1 -0
- package/components/Pagination/Pagination.js +83 -0
- package/components/Pagination/index.js +1 -0
- package/components/ProgressBar/ProgressBar.js +84 -0
- package/components/ProgressBar/index.js +1 -0
- package/components/ProgressSteps/ProgressSteps.js +121 -0
- package/components/ProgressSteps/index.js +1 -0
- package/components/Rating/Rating.js +264 -0
- package/components/Rating/index.js +1 -0
- package/components/SecondaryLink/DarkSecondaryLink.js +97 -0
- package/components/SecondaryLink/LightSecondaryLink.js +93 -0
- package/components/SecondaryLink/index.js +3 -0
- package/components/Sidebar/Navbar.js +328 -0
- package/components/Sidebar/Sidebar.js +180 -0
- package/components/Sidebar/index.js +3 -0
- package/components/StatusChip/PrimaryStatusChip.js +78 -0
- package/components/StatusChip/SecondaryStatusChip.js +78 -0
- package/components/StatusChip/SlimPrimaryStatusChip.js +92 -0
- package/components/StatusChip/SlimSecondaryStatusChip.js +93 -0
- package/components/StatusChip/index.js +6 -0
- package/components/StatusCircle/StatusCircle.js +64 -0
- package/components/StatusCircle/index.js +1 -0
- package/components/Tables/Table.js +156 -0
- package/components/Tables/index.js +1 -0
- package/components/Tooltip/Tooltip.js +479 -0
- package/components/Tooltip/index.js +1 -0
- package/components/Typography/Typography.js +78 -0
- package/components/Typography/index.js +2 -0
- package/components/constants/colors.js +33 -0
- package/components/constants/defaultStyle.js +781 -0
- package/components/constants/defaultThemeColor.js +15 -0
- package/components/constants/index.js +7 -0
- package/components/constants/utils.js +31 -0
- package/components/global/FontStyle.js +131 -0
- package/components/global/index.js +1 -0
- package/dist/index.es.js +2302 -0
- package/dist/index.js +2302 -0
- package/index.js +40 -0
- package/package.json +67 -0
- package/rollup.config.js +53 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from "react";
|
|
2
|
+
import DatePicker from 'react-datepicker';
|
|
3
|
+
import 'react-datepicker/dist/react-datepicker.css'
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import defaultThemeColor from '../constants/defaultThemeColor';
|
|
7
|
+
|
|
8
|
+
import { Icon } from "../Icon";
|
|
9
|
+
|
|
10
|
+
const border = `#D4D7E3`;
|
|
11
|
+
|
|
12
|
+
const Wrapper = styled.div`
|
|
13
|
+
|
|
14
|
+
display: flex;
|
|
15
|
+
cursor: ${({ disabled }) => disabled ? 'not-allowed' : 'text'};
|
|
16
|
+
|
|
17
|
+
.react-datepicker-wrapper {
|
|
18
|
+
display: flex;
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.react-datepicker {
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
background-color: ${({ theme }) => theme.bgColor};
|
|
25
|
+
color: #444444;
|
|
26
|
+
border: 1px solid ${({ theme }) => theme.neutral['neutral-5']};
|
|
27
|
+
border-radius: 6.6px;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
position: relative;
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.react-datepicker__input-container{
|
|
35
|
+
border: 1px solid ${border};
|
|
36
|
+
border-radius: 4px;
|
|
37
|
+
padding: 8px 12px;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
&:focus-within {
|
|
43
|
+
border: 1px solid ${({ theme }) => theme.variant['primary-1']};
|
|
44
|
+
outline: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
input {
|
|
48
|
+
border: none;
|
|
49
|
+
outline: none;
|
|
50
|
+
width:100%;
|
|
51
|
+
cursor: ${({ disabled }) => disabled ? 'not-allowed' : 'text'};
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.react-datepicker__triangle {
|
|
57
|
+
::before, ::after{
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.react-datepicker__month-container {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
align-content: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
.react-datepicker__month-select{
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
border: none;
|
|
73
|
+
}
|
|
74
|
+
.react-datepicker__current-month,
|
|
75
|
+
.react-datepicker-time__header,
|
|
76
|
+
.react-datepicker-year-header,
|
|
77
|
+
.react-datepicker__navigation {
|
|
78
|
+
display: none;
|
|
79
|
+
}
|
|
80
|
+
.react-datepicker__day--outside-month {
|
|
81
|
+
color:#A9B1B8 !important;
|
|
82
|
+
}
|
|
83
|
+
.react-datepicker__header__dropdown,
|
|
84
|
+
.react-datepicker__header__dropdown--select{
|
|
85
|
+
margin-top:16px;
|
|
86
|
+
margin-bottom:30px;
|
|
87
|
+
border: none;
|
|
88
|
+
}
|
|
89
|
+
.react-datepicker__header {
|
|
90
|
+
text-align: center;
|
|
91
|
+
border-bottom: none;
|
|
92
|
+
border-top-left-radius: 6.6px;
|
|
93
|
+
border-top-right-radius: 6.6px;
|
|
94
|
+
padding: 0;
|
|
95
|
+
position: relative;
|
|
96
|
+
background-color: ${({ theme }) => theme.bgColor};
|
|
97
|
+
}
|
|
98
|
+
.react-datepicker__year-select {
|
|
99
|
+
border:none;
|
|
100
|
+
|
|
101
|
+
&::focus-visible{
|
|
102
|
+
border:none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
.react-datepicker__day {
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
padding: 3px;
|
|
108
|
+
color: ${({ theme }) => theme.textColor}
|
|
109
|
+
}
|
|
110
|
+
.react-datepicker__day--selected,
|
|
111
|
+
.react-datepicker__day--keyboard-selected {
|
|
112
|
+
background: ${({ theme }) => theme.variant['primary-1']};
|
|
113
|
+
border-radius: 2.4px;
|
|
114
|
+
color: ${({ theme }) => theme.bgColor}
|
|
115
|
+
}
|
|
116
|
+
.react-datepicker__day-names ,
|
|
117
|
+
.react-datepicker__day-name {
|
|
118
|
+
color: #9D9D9D;
|
|
119
|
+
padding: 3px;
|
|
120
|
+
text-transform: uppercase;
|
|
121
|
+
font-size: 12px !important;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.react-datepicker__day-names{
|
|
125
|
+
margin-bottom: -14px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.calender-year{
|
|
129
|
+
select{
|
|
130
|
+
border: none;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
outline: none;
|
|
133
|
+
font-size: 16px;
|
|
134
|
+
font-weight:bold ;
|
|
135
|
+
&:focus{
|
|
136
|
+
outline: none;
|
|
137
|
+
border: none;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
|
|
143
|
+
Wrapper.defaultProps = {
|
|
144
|
+
theme: defaultThemeColor
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const CalendarHeaderDiv = styled.div`
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: flex-start;
|
|
150
|
+
justify-content:center;
|
|
151
|
+
font-size: 16px;
|
|
152
|
+
padding-top:12px;
|
|
153
|
+
padding-bottom:15px;
|
|
154
|
+
`;
|
|
155
|
+
|
|
156
|
+
const IconDiv = styled.div`
|
|
157
|
+
display: flex;
|
|
158
|
+
justify-content: center;
|
|
159
|
+
margin-left: 6px;
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
const DropDownContainer = styled("div")`
|
|
164
|
+
width: inherit;
|
|
165
|
+
`;
|
|
166
|
+
|
|
167
|
+
const DropDownHeader = styled("div")`
|
|
168
|
+
display: flex;
|
|
169
|
+
flex-direction: row;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
const DropDownListContainer = styled("div")`
|
|
174
|
+
margin-top: 8px;
|
|
175
|
+
position: absolute;
|
|
176
|
+
z-index: 100;
|
|
177
|
+
width: inherit;
|
|
178
|
+
margin-left: -20px;
|
|
179
|
+
overflow-y: hidden;
|
|
180
|
+
overflow-x: hidden;
|
|
181
|
+
background: white;
|
|
182
|
+
box-shadow: 0px 6px 20px rgb(56 66 100 / 15%);
|
|
183
|
+
border-radius: 4px;
|
|
184
|
+
`;
|
|
185
|
+
|
|
186
|
+
const DropDownList = styled("ul")`
|
|
187
|
+
list-style: none;
|
|
188
|
+
padding: 0;
|
|
189
|
+
margin: 12px;
|
|
190
|
+
margin-right: 8px;
|
|
191
|
+
padding-bottom: 10px;
|
|
192
|
+
width: 132px;
|
|
193
|
+
height: 178px;
|
|
194
|
+
overflow-y: scroll;
|
|
195
|
+
overflow-x: hidden;
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
::-webkit-scrollbar {
|
|
199
|
+
width: 6px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
::-webkit-scrollbar-thumb {
|
|
203
|
+
background-clip: padding-box;
|
|
204
|
+
border-radius: 10px;
|
|
205
|
+
background-color: ${({ theme }) => theme.neutral['neutral-3']};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
/* Track */
|
|
212
|
+
::-webkit-scrollbar-track {
|
|
213
|
+
// margin: 5px;
|
|
214
|
+
background-color:${({ theme }) => theme.neutral['neutral-4']};
|
|
215
|
+
border-radius: 10px;
|
|
216
|
+
}
|
|
217
|
+
`;
|
|
218
|
+
DropDownList.defaultProps = {
|
|
219
|
+
theme: defaultThemeColor,
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const ListItem = styled("li")`
|
|
223
|
+
text-align: left;
|
|
224
|
+
font-style: normal;
|
|
225
|
+
font-weight: normal;
|
|
226
|
+
font-size: 14px;
|
|
227
|
+
line-height: 17px;
|
|
228
|
+
padding-left: 12px;
|
|
229
|
+
padding-bottom: 12px;
|
|
230
|
+
cursor: pointer;
|
|
231
|
+
`;
|
|
232
|
+
|
|
233
|
+
export const DateSelect = ({ startDate, setStartDate, disabled, ...props }) => {
|
|
234
|
+
const theme = defaultThemeColor;
|
|
235
|
+
|
|
236
|
+
const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
237
|
+
var years = [];
|
|
238
|
+
for (var i = 2010; i <= ((new Date()).getFullYear() + 10); i++) {
|
|
239
|
+
years.push(i);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const refMonth = useRef(null);
|
|
243
|
+
const refYear = useRef(null);
|
|
244
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
245
|
+
const [isOpenYear, setIsOpenYear] = useState(false);
|
|
246
|
+
const [hover, setHover] = useState(false);
|
|
247
|
+
const [hoverYear, setHoverYear] = useState(false);
|
|
248
|
+
const [selectedYear, setSelectedYear] = useState(startDate.getFullYear());
|
|
249
|
+
const [selectedMonth, setSelectedMonth] = useState(months[startDate.getMonth()]);
|
|
250
|
+
|
|
251
|
+
useEffect(() => {
|
|
252
|
+
setSelectedMonth(months[startDate.getMonth()]);
|
|
253
|
+
setSelectedYear(startDate.getFullYear());
|
|
254
|
+
}, [startDate])
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
useEffect(() => {
|
|
258
|
+
document.addEventListener("click", handleClickOutsideMonth, true);
|
|
259
|
+
|
|
260
|
+
return () => {
|
|
261
|
+
document.removeEventListener("click", handleClickOutsideMonth, true);
|
|
262
|
+
};
|
|
263
|
+
}, []);
|
|
264
|
+
|
|
265
|
+
const handleClickOutsideMonth = (event) => {
|
|
266
|
+
if (refMonth.current && !refMonth.current.contains(event.target)) {
|
|
267
|
+
setIsOpen(false)
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const handleClickOutsideYear = (event) => {
|
|
272
|
+
if (refYear.current && !refYear.current.contains(event.target)) {
|
|
273
|
+
setIsOpenYear(false)
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
useEffect(() => {
|
|
278
|
+
document.addEventListener("click", handleClickOutsideYear, true);
|
|
279
|
+
|
|
280
|
+
return () => {
|
|
281
|
+
document.removeEventListener("click", handleClickOutsideYear, true);
|
|
282
|
+
};
|
|
283
|
+
}, []);
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
return (
|
|
287
|
+
<Wrapper disabled={disabled} {...props}>
|
|
288
|
+
<DatePicker
|
|
289
|
+
selected={startDate}
|
|
290
|
+
useWeekdaysShort={true}
|
|
291
|
+
onChange={(date) => setStartDate(date)}
|
|
292
|
+
placeholderText={'select date'}
|
|
293
|
+
adjustDateOnChange
|
|
294
|
+
disabled={disabled}
|
|
295
|
+
dropdownMode="select"
|
|
296
|
+
renderCustomHeader={({
|
|
297
|
+
date,
|
|
298
|
+
changeYear,
|
|
299
|
+
changeMonth,
|
|
300
|
+
}) => {
|
|
301
|
+
return (
|
|
302
|
+
<CalendarHeaderDiv>
|
|
303
|
+
<div style={{ display: 'flex' }}>
|
|
304
|
+
<DropDownContainer ref={refMonth}>
|
|
305
|
+
<DropDownHeader
|
|
306
|
+
onClick={() => {
|
|
307
|
+
setIsOpen(!isOpen);
|
|
308
|
+
setIsOpenYear(false)
|
|
309
|
+
}}>
|
|
310
|
+
<span
|
|
311
|
+
onMouseEnter={() => setHover(true)}
|
|
312
|
+
onMouseLeave={() => setHover(false)}
|
|
313
|
+
style={{ color: `${hover ? theme.variant['primary-1'] : theme.textColor}` }}>
|
|
314
|
+
{months[date.getMonth()]}
|
|
315
|
+
</span>
|
|
316
|
+
<IconDiv>
|
|
317
|
+
<Icon icon='triangle-down'
|
|
318
|
+
color={hover ? 'blue' : 'black'}
|
|
319
|
+
size={7} />
|
|
320
|
+
</IconDiv>
|
|
321
|
+
</DropDownHeader>
|
|
322
|
+
{isOpen && (
|
|
323
|
+
<DropDownListContainer>
|
|
324
|
+
<DropDownList onMouseEnter={() => setHover(true)}>
|
|
325
|
+
{months.map((option, index) => (
|
|
326
|
+
<ListItem selectedMonth={selectedMonth}
|
|
327
|
+
onClick={() => {
|
|
328
|
+
setHover(false);
|
|
329
|
+
changeMonth(index);
|
|
330
|
+
setIsOpen(false);
|
|
331
|
+
setSelectedMonth(months[index]);
|
|
332
|
+
}}
|
|
333
|
+
key={Math.random()}>
|
|
334
|
+
<span
|
|
335
|
+
style={{ color: `${selectedMonth === option ? theme.variant['primary-1'] : theme.textColor}` }}
|
|
336
|
+
>{option}</span>
|
|
337
|
+
</ListItem>
|
|
338
|
+
))}
|
|
339
|
+
</DropDownList>
|
|
340
|
+
</DropDownListContainer>
|
|
341
|
+
)}
|
|
342
|
+
</DropDownContainer>
|
|
343
|
+
<DropDownContainer ref={refYear}>
|
|
344
|
+
<DropDownHeader
|
|
345
|
+
style={{ marginLeft: '28px' }}
|
|
346
|
+
onClick={() => {
|
|
347
|
+
setIsOpenYear(!isOpenYear);
|
|
348
|
+
setIsOpen(false)
|
|
349
|
+
}}>
|
|
350
|
+
<span onMouseEnter={() => setHoverYear(true)}
|
|
351
|
+
onMouseLeave={() => setHoverYear(false)}
|
|
352
|
+
style={{ color: `${hoverYear ? theme.variant['primary-1'] : theme.textColor}` }}>
|
|
353
|
+
{(date).getFullYear()}
|
|
354
|
+
</span>
|
|
355
|
+
<IconDiv>
|
|
356
|
+
<Icon icon='triangle-down'
|
|
357
|
+
color={hoverYear ? 'blue' : 'black'}
|
|
358
|
+
size={7} />
|
|
359
|
+
</IconDiv>
|
|
360
|
+
</DropDownHeader>
|
|
361
|
+
{isOpenYear && (
|
|
362
|
+
<DropDownListContainer>
|
|
363
|
+
<DropDownList onMouseEnter={() => setHoverYear(true)}>
|
|
364
|
+
{years.map((option, index) => (
|
|
365
|
+
<ListItem
|
|
366
|
+
onClick={() => {
|
|
367
|
+
setHoverYear(false);
|
|
368
|
+
changeYear(option);
|
|
369
|
+
setSelectedYear(option);
|
|
370
|
+
setIsOpenYear(false);
|
|
371
|
+
}}
|
|
372
|
+
key={Math.random()}>
|
|
373
|
+
<span
|
|
374
|
+
style={{ color: `${selectedYear === option ? theme.variant['primary-1'] : theme.textColor}` }}>
|
|
375
|
+
{option}
|
|
376
|
+
</span>
|
|
377
|
+
</ListItem>
|
|
378
|
+
))}
|
|
379
|
+
</DropDownList>
|
|
380
|
+
</DropDownListContainer>
|
|
381
|
+
)}
|
|
382
|
+
</DropDownContainer>
|
|
383
|
+
</div>
|
|
384
|
+
</CalendarHeaderDiv>
|
|
385
|
+
)
|
|
386
|
+
}}
|
|
387
|
+
/>
|
|
388
|
+
</Wrapper>
|
|
389
|
+
);
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
DateSelect.propTypes = {
|
|
393
|
+
/**
|
|
394
|
+
* Date Props in GMT Format
|
|
395
|
+
*/
|
|
396
|
+
startDate: PropTypes.any,
|
|
397
|
+
/**
|
|
398
|
+
* Date onChange Function
|
|
399
|
+
*/
|
|
400
|
+
setStartDate: PropTypes.func,
|
|
401
|
+
/**
|
|
402
|
+
* Disable property of DateSelect
|
|
403
|
+
*/
|
|
404
|
+
disabled: PropTypes.bool
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
DateSelect.defaultProps = {
|
|
408
|
+
startDate: '',
|
|
409
|
+
setStartDate: () => { },
|
|
410
|
+
disabled: false
|
|
411
|
+
}
|