intelicoreact 0.0.94 → 0.0.95
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/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +23 -4
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +3 -3
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +20 -9
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +7 -5
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +29 -24
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +13 -7
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +427 -0
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.scss +120 -0
- package/dist/{Molecular/Datepicker/Datepicker.stories.js → Atomic/FormElements/MobileCalendar/MobileCalendar.stories.js} +33 -21
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +11 -8
- package/dist/Atomic/UI/Calendar/Calendar.js +13 -12
- package/dist/Functions/customEventListener.js +66 -0
- package/package.json +1 -1
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.js +34 -3
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +4 -4
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.js +57 -22
- package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +10 -8
- package/src/Atomic/FormElements/InputDateRange/components/Datepicker.js +391 -392
- package/src/Atomic/FormElements/InputDateRange/components/OpenedPart.js +11 -3
- package/src/Atomic/FormElements/MobileCalendar/MobileCalendar.js +315 -0
- package/src/Atomic/FormElements/MobileCalendar/MobileCalendar.scss +120 -0
- package/src/Atomic/FormElements/MobileCalendar/MobileCalendar.stories.js +30 -0
- package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.js +132 -126
- package/src/Atomic/UI/Calendar/Calendar.js +21 -11
- package/src/Functions/customEventListener.js +58 -0
- package/src/Functions/useMouseUpOutside.js +14 -0
- package/dist/Functions/useToggle.js +0 -40
- package/dist/Functions/utils.js +0 -66
- package/dist/Molecular/Datepicker/Datepicker.js +0 -451
- package/dist/Molecular/Datepicker/Datepicker.scss +0 -8
- package/dist/Molecular/Datepicker/components/Calendar.js +0 -156
- package/dist/Molecular/FormElements/FormElement.js +0 -40
- package/dist/Molecular/FormElements/FormElement.scss +0 -8
- package/dist/Molecular/FormElements/FormElement.stories.js +0 -73
- package/dist/index.js +0 -15
- package/dist/scss/_fonts.scss +0 -109
- package/dist/scss/_vars.scss +0 -48
- package/dist/scss/main.scss +0 -40
|
@@ -26,8 +26,12 @@ const OpenedPart = React.forwardRef((props, ref) => {
|
|
|
26
26
|
setIsCompare,
|
|
27
27
|
toggleOff,
|
|
28
28
|
isShortWeekNames,
|
|
29
|
-
minDate
|
|
30
|
-
maxDate
|
|
29
|
+
minDate,
|
|
30
|
+
maxDate,
|
|
31
|
+
format,
|
|
32
|
+
momentMinDate,
|
|
33
|
+
momentMaxDate,
|
|
34
|
+
isDontLimitFuture,
|
|
31
35
|
} = props;
|
|
32
36
|
|
|
33
37
|
const items = isCompact ? [...Object.keys(intervals)] : [...Object.keys(intervals), customKey];
|
|
@@ -82,7 +86,7 @@ const OpenedPart = React.forwardRef((props, ref) => {
|
|
|
82
86
|
label={(txt?.labels && txt?.labels[item]) || intervals[item]?.label || (item === customKey ? CUSTOM_INTERVAL_KEY_TEXT : item )}
|
|
83
87
|
isActive={activeInterval === item}
|
|
84
88
|
onItemClick={() => handleItemClick(item.value || item)}
|
|
85
|
-
disabled={item === customKey}
|
|
89
|
+
disabled={item === customKey || (minDate && intervals[item]?.start?.()?.isBefore?.(momentMinDate))}
|
|
86
90
|
/>
|
|
87
91
|
))}
|
|
88
92
|
</div>
|
|
@@ -109,6 +113,10 @@ const OpenedPart = React.forwardRef((props, ref) => {
|
|
|
109
113
|
isShortWeekNames={isShortWeekNames}
|
|
110
114
|
minDate={minDate}
|
|
111
115
|
maxDate={maxDate}
|
|
116
|
+
format={format}
|
|
117
|
+
momentMinDate={momentMinDate}
|
|
118
|
+
momentMaxDate={momentMaxDate}
|
|
119
|
+
isDontLimitFuture={isDontLimitFuture}
|
|
112
120
|
/>
|
|
113
121
|
)}
|
|
114
122
|
</div>
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, useMemo } from 'react';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
|
|
4
|
+
import './MobileCalendar.scss';
|
|
5
|
+
import { ChevronDown, ChevronUp } from 'react-feather';
|
|
6
|
+
import { IoFastFood } from 'react-icons/io5';
|
|
7
|
+
|
|
8
|
+
require('./../../../../src/Functions/customEventListener');
|
|
9
|
+
|
|
10
|
+
const MobileCalendar = ({
|
|
11
|
+
minDate = moment().subtract('10', 'years'),
|
|
12
|
+
maxDate = moment().add('10', 'years'),
|
|
13
|
+
value,
|
|
14
|
+
rows = 5,
|
|
15
|
+
label = "",
|
|
16
|
+
timeout = 500,
|
|
17
|
+
isMobile = true,
|
|
18
|
+
showSelectedDate = false,
|
|
19
|
+
|
|
20
|
+
classes = {
|
|
21
|
+
wrapper: "",
|
|
22
|
+
label: "",
|
|
23
|
+
body: "",
|
|
24
|
+
|
|
25
|
+
yearsBlock: "",
|
|
26
|
+
yearsList: "",
|
|
27
|
+
yearsListItem: "",
|
|
28
|
+
|
|
29
|
+
monthsBlock: "",
|
|
30
|
+
monthsList: "",
|
|
31
|
+
monthsListItem: "",
|
|
32
|
+
|
|
33
|
+
daysBlock: "",
|
|
34
|
+
daysList: "",
|
|
35
|
+
daysListItem: "",
|
|
36
|
+
|
|
37
|
+
prevItem: "",
|
|
38
|
+
nextItem: "",
|
|
39
|
+
activeItem: "",
|
|
40
|
+
},
|
|
41
|
+
onChange = () => {},
|
|
42
|
+
}) => {
|
|
43
|
+
const Body = document.querySelector("body");
|
|
44
|
+
const listItem = document.querySelector(".mobile-calendar_wrapper_body_months-list--item");
|
|
45
|
+
|
|
46
|
+
const [date, setDate] = useState(value || moment());
|
|
47
|
+
|
|
48
|
+
const [isMouseDown, setIsMouseDown] = useState(false);
|
|
49
|
+
const [mouseDownOn, setMouseDownOn] = useState(null);
|
|
50
|
+
const [changeInterval, setChangeInterval] = useState(null);
|
|
51
|
+
|
|
52
|
+
const [touchY, setTouchY] = useState(null);
|
|
53
|
+
const [touchType, setTouchType] = useState(null);
|
|
54
|
+
const [touchTimestamp, setTouchTimestamp] = useState(null);
|
|
55
|
+
|
|
56
|
+
const [scrollDirection, setScrollDirection] = useState(0);
|
|
57
|
+
|
|
58
|
+
const listItemHeight = listItem?.getBoundingClientRect()?.height;
|
|
59
|
+
|
|
60
|
+
//--HANDLERS--//
|
|
61
|
+
const changeItem = (type, value) => {
|
|
62
|
+
setScrollDirection(value);
|
|
63
|
+
setDate((date) => {
|
|
64
|
+
const newDate = moment(date).add(value, type);
|
|
65
|
+
|
|
66
|
+
if(moment(newDate).isBefore(minDate)) return minDate;
|
|
67
|
+
if(moment(newDate).isAfter(maxDate)) return maxDate;
|
|
68
|
+
|
|
69
|
+
return newDate;
|
|
70
|
+
});
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
setScrollDirection(0);
|
|
73
|
+
}, 50);
|
|
74
|
+
};
|
|
75
|
+
const onArrowMouseDown = (type, value) => {
|
|
76
|
+
setIsMouseDown(true);
|
|
77
|
+
setMouseDownOn({ type, value });
|
|
78
|
+
};
|
|
79
|
+
const onArrowMouseUp = () => {
|
|
80
|
+
setIsMouseDown(false);
|
|
81
|
+
setMouseDownOn(null);
|
|
82
|
+
};
|
|
83
|
+
const onWheel = (e, type) => {
|
|
84
|
+
const { deltaY } = e;
|
|
85
|
+
|
|
86
|
+
changeItem(type, deltaY < 0 ? -1 : 1);
|
|
87
|
+
};
|
|
88
|
+
const onTouchStart = (e, type) => {
|
|
89
|
+
const { timeStamp, changedTouches } = e;
|
|
90
|
+
const { pageY } = changedTouches[0];
|
|
91
|
+
|
|
92
|
+
setTouchY(pageY);
|
|
93
|
+
setTouchTimestamp(timeStamp);
|
|
94
|
+
setTouchType(type);
|
|
95
|
+
|
|
96
|
+
Body?.addEventListener('touchend', (e) => onTouchEnd(e, pageY, timeStamp, type));
|
|
97
|
+
|
|
98
|
+
};
|
|
99
|
+
const onTouchMove = (e) => {
|
|
100
|
+
if(!touchY || !touchType) return;
|
|
101
|
+
|
|
102
|
+
const { timeStamp, changedTouches } = e;
|
|
103
|
+
const { pageY } = changedTouches[0];
|
|
104
|
+
|
|
105
|
+
const deltaY = touchY - pageY;
|
|
106
|
+
|
|
107
|
+
if(Math.abs(deltaY) < listItemHeight/2) return;
|
|
108
|
+
|
|
109
|
+
const direction = deltaY < 0 ? -1 : 1;
|
|
110
|
+
|
|
111
|
+
setScrollDirection(direction);
|
|
112
|
+
|
|
113
|
+
changeItem(touchType, direction);
|
|
114
|
+
setTouchY(pageY);
|
|
115
|
+
setTouchTimestamp(timeStamp);
|
|
116
|
+
};
|
|
117
|
+
const onTouchEnd = (e, startY, startTime, touchType) => {
|
|
118
|
+
const { timeStamp, changedTouches } = e;
|
|
119
|
+
const { pageY } = changedTouches[0];
|
|
120
|
+
|
|
121
|
+
const path = Math.abs(startY-pageY);//in px
|
|
122
|
+
const time = timeStamp-startTime;//ms
|
|
123
|
+
const pxPerMs = path/time;
|
|
124
|
+
|
|
125
|
+
if(pxPerMs > 1)
|
|
126
|
+
innertionScroll({startY, pageY, timeStamp, startTime, touchType});
|
|
127
|
+
else
|
|
128
|
+
setTouchType(null);
|
|
129
|
+
|
|
130
|
+
setTouchY(null);
|
|
131
|
+
|
|
132
|
+
Body?.clearEventListeners('touchend');
|
|
133
|
+
};
|
|
134
|
+
const innertionScroll = ({startY, pageY, timeStamp, startTime, touchType}) => {
|
|
135
|
+
const path = Math.abs(startY-pageY);//in px
|
|
136
|
+
const time = timeStamp-startTime;//ms
|
|
137
|
+
const pxPerMs = path/time;//speed
|
|
138
|
+
|
|
139
|
+
const S = (pxPerMs/2*time)/2;
|
|
140
|
+
const blocks = Math.ceil(S/listItemHeight)*6*pxPerMs;
|
|
141
|
+
let timeout;
|
|
142
|
+
|
|
143
|
+
for(let i = 1; i <= blocks; ++i){
|
|
144
|
+
timeout = i*pxPerMs+Math.pow(i,2)*1.2;
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
changeItem(touchType, startY-pageY < 0 ? -1 : 1);
|
|
147
|
+
}, timeout)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
setTimeout(() => {
|
|
151
|
+
setTouchType(null);
|
|
152
|
+
}, timeout)
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
//--FUNCTIONS--//
|
|
156
|
+
const intervalWorker = () => {
|
|
157
|
+
if(!mouseDownOn) return;
|
|
158
|
+
|
|
159
|
+
const { type, value } = mouseDownOn;
|
|
160
|
+
changeItem(type, value);
|
|
161
|
+
};
|
|
162
|
+
const getList = (type, format) => {
|
|
163
|
+
const list = [];
|
|
164
|
+
|
|
165
|
+
const renderRows = rows;
|
|
166
|
+
|
|
167
|
+
for (let i = (renderRows - 1) / 2; i >= ((renderRows - 1) / 2) * -1; --i) {
|
|
168
|
+
list.push(moment(date).subtract(i, type).format(format));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return list;
|
|
172
|
+
};
|
|
173
|
+
const getMonthList = () => getList('months', 'MMMM');
|
|
174
|
+
const getDaysList = () => getList('days', 'D');
|
|
175
|
+
const getYearsList = () => getList('years', 'YYYY');
|
|
176
|
+
|
|
177
|
+
//--OBSERVERS--//
|
|
178
|
+
//Events Observer
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
document.addEventListener('mouseup', onArrowMouseUp);
|
|
181
|
+
return () => {
|
|
182
|
+
document.removeEventListener('mouseup', onArrowMouseUp);
|
|
183
|
+
};
|
|
184
|
+
}, []);
|
|
185
|
+
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
onChange(date);
|
|
188
|
+
}, [date]);
|
|
189
|
+
|
|
190
|
+
//--RENDER--//
|
|
191
|
+
const renderMonthsList = () => {
|
|
192
|
+
const half = (rows-1)/2;
|
|
193
|
+
return getMonthList()
|
|
194
|
+
.map((month, i) => (
|
|
195
|
+
<div
|
|
196
|
+
className={`mobile-calendar_wrapper_body_months-list--item ${i === half ? 'active' : ''} ${i === 0 || i === rows-1 ? 'transparent' : ''} ${classes?.monthsListItem} ${i === half ? classes?.activeItem : ''}`}
|
|
197
|
+
key={`month-${month}`}
|
|
198
|
+
onClick={touchY ? null : () => i-half === 0 ? ({}) : changeItem('months', i-half)}
|
|
199
|
+
attr-scroll-direction={touchType === 'months' ? scrollDirection : 0}
|
|
200
|
+
attr-is-scrolling={touchType === 'months' ? 1 : 0}
|
|
201
|
+
>
|
|
202
|
+
{month}
|
|
203
|
+
</div>
|
|
204
|
+
));
|
|
205
|
+
};
|
|
206
|
+
const renderDaysList = () => {
|
|
207
|
+
const half = (rows-1)/2;
|
|
208
|
+
return getDaysList()
|
|
209
|
+
.map((day, i) => (
|
|
210
|
+
<div
|
|
211
|
+
className={`mobile-calendar_wrapper_body_days-list--item ${i === half ? 'active' : ''} ${i === 0 || i === rows-1 ? 'transparent' : ''} ${classes?.daysListItem} ${i === half ? classes?.activeItem : ''}`}
|
|
212
|
+
key={`day-${day}`}
|
|
213
|
+
onClick={() => i-half === 0 ? ({}) : changeItem('days', i-half)}
|
|
214
|
+
attr-scroll-direction={touchType === 'days' ? scrollDirection : 0}
|
|
215
|
+
attr-is-scrolling={touchType === 'days' ? 1 : 0}
|
|
216
|
+
>
|
|
217
|
+
{day}
|
|
218
|
+
</div>
|
|
219
|
+
));
|
|
220
|
+
};
|
|
221
|
+
const renderYearsList = () => {
|
|
222
|
+
const half = (rows-1)/2;
|
|
223
|
+
return getYearsList()
|
|
224
|
+
.map((year, i) => (
|
|
225
|
+
<div
|
|
226
|
+
className={`mobile-calendar_wrapper_body_years-list--item ${i === half ? 'active' : ''} ${i === 0 || i === rows-1 ? 'transparent' : ''} ${classes?.yearsListItem} ${i === half ? classes?.activeItem : ''}`}
|
|
227
|
+
key={`year-${year}`}
|
|
228
|
+
onClick={() => i-half === 0 ? ({}) : changeItem('years', i-half)}
|
|
229
|
+
attr-scroll-direction={touchType === 'years' ? scrollDirection : 0}
|
|
230
|
+
attr-is-scrolling={touchType === 'years' ? 1 : 0}
|
|
231
|
+
>
|
|
232
|
+
{year}
|
|
233
|
+
</div>
|
|
234
|
+
));
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const renderMonthBlock = () => {
|
|
238
|
+
return (
|
|
239
|
+
<div className={`mobile-calendar_wrapper_body_months ${classes?.monthsBlock}`}>
|
|
240
|
+
<div className={`mobile-calendar_wrapper_body_months--prev ${classes?.prevItem}`}>
|
|
241
|
+
<ChevronUp onClick={() => changeItem('months', -1)} onMouseDown={() => onArrowMouseDown('months', -1)} onMouseUp={onArrowMouseUp} />
|
|
242
|
+
</div>
|
|
243
|
+
<div
|
|
244
|
+
className={`mobile-calendar_wrapper_body_months-list ${classes?.monthsList}`}
|
|
245
|
+
onTouchStart={(e) => onTouchStart(e, "months")}
|
|
246
|
+
onWheel={(e) => onWheel(e, "months")}
|
|
247
|
+
>
|
|
248
|
+
{renderMonthsList()}
|
|
249
|
+
{isMobile && <div className="mobile-calendar_wrapper_body_months-list_touch-zone"></div>}
|
|
250
|
+
</div>
|
|
251
|
+
<div className={`mobile-calendar_wrapper_body_months--next ${classes?.nextItem}`}>
|
|
252
|
+
<ChevronDown onClick={() => changeItem('months', 1)} onMouseDown={() => onArrowMouseDown('months', 1)} onMouseUp={onArrowMouseUp} />
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
const renderDaysBlock = () => {
|
|
258
|
+
return (
|
|
259
|
+
<div className={`mobile-calendar_wrapper_body_days ${classes?.daysBlock}`}>
|
|
260
|
+
<div className={`mobile-calendar_wrapper_body_days--prev ${classes?.prevItem}`}>
|
|
261
|
+
<ChevronUp onClick={() => changeItem('days', -1)} onMouseDown={() => onArrowMouseDown('days', -1)} onMouseUp={onArrowMouseUp} />
|
|
262
|
+
</div>
|
|
263
|
+
<div
|
|
264
|
+
className={`mobile-calendar_wrapper_body_days-list ${classes?.daysList}`}
|
|
265
|
+
onTouchStart={(e) => onTouchStart(e, "days")}
|
|
266
|
+
onWheel={(e) => onWheel(e, "days")}
|
|
267
|
+
>
|
|
268
|
+
{renderDaysList()}
|
|
269
|
+
{isMobile && <div className="mobile-calendar_wrapper_body_days-list_touch-zone"></div>}
|
|
270
|
+
</div>
|
|
271
|
+
<div className={`mobile-calendar_wrapper_body_days--next ${classes?.nextItem}`}>
|
|
272
|
+
<ChevronDown onClick={() => changeItem('days', 1)} onMouseDown={() => onArrowMouseDown('days', 1)} onMouseUp={onArrowMouseUp} />
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
);
|
|
276
|
+
};
|
|
277
|
+
const renderYearsBlock = () => {
|
|
278
|
+
return (
|
|
279
|
+
<div className={`mobile-calendar_wrapper_body_years ${classes?.yearsBlock}`}>
|
|
280
|
+
<div className={`mobile-calendar_wrapper_body_years--prev ${classes?.prevItem}`}>
|
|
281
|
+
<ChevronUp onClick={() => changeItem('years', -1)} onMouseDown={() => onArrowMouseDown('years', -1)} onMouseUp={onArrowMouseUp} />
|
|
282
|
+
</div>
|
|
283
|
+
<div
|
|
284
|
+
className={`mobile-calendar_wrapper_body_years-list ${classes?.yearsList}`}
|
|
285
|
+
onTouchStart={(e) => onTouchStart(e, "years")}
|
|
286
|
+
onWheel={(e) => onWheel(e, "years")}
|
|
287
|
+
>
|
|
288
|
+
{renderYearsList()}
|
|
289
|
+
{isMobile && <div className="mobile-calendar_wrapper_body_years-list_touch-zone"></div>}
|
|
290
|
+
</div>
|
|
291
|
+
<div className={`mobile-calendar_wrapper_body_years--next ${classes?.nextItem}`}>
|
|
292
|
+
<ChevronDown onClick={() => changeItem('years', 1)} onMouseDown={() => onArrowMouseDown('years', 1)} onMouseUp={onArrowMouseUp} />
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
return (
|
|
299
|
+
<div
|
|
300
|
+
className={`mobile-calendar_wrapper ${classes?.wrapper}`}
|
|
301
|
+
|
|
302
|
+
onTouchMove={onTouchMove}
|
|
303
|
+
>
|
|
304
|
+
<div className={`mobile-calendar_wrapper_label ${classes?.label}`}>{label}</div>
|
|
305
|
+
{showSelectedDate && <div className={`mobile-calendar_wrapper_label ${classes?.label}`}>{moment(date).format("LL")}</div>}
|
|
306
|
+
<div className={`mobile-calendar_wrapper_body ${classes?.body}`}>
|
|
307
|
+
{renderMonthBlock()}
|
|
308
|
+
{renderDaysBlock()}
|
|
309
|
+
{renderYearsBlock()}
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
export default MobileCalendar;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
.unselectable {
|
|
2
|
+
-webkit-touch-callout: none;
|
|
3
|
+
-webkit-user-select: none;
|
|
4
|
+
-khtml-user-select: none;
|
|
5
|
+
-moz-user-select: none;
|
|
6
|
+
-ms-user-select: none;
|
|
7
|
+
user-select: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.mobile-calendar_wrapper{
|
|
11
|
+
@extend .unselectable;
|
|
12
|
+
max-width: 350px;
|
|
13
|
+
background: #F8FBFF;
|
|
14
|
+
padding: 10px;
|
|
15
|
+
box-shadow: 0 0 10px 10px #00000014;
|
|
16
|
+
border-radius: 16px;
|
|
17
|
+
|
|
18
|
+
&_label{
|
|
19
|
+
text-align: center;
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
margin: 16px 0px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&_body{
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
|
|
29
|
+
&_months,
|
|
30
|
+
&_days,
|
|
31
|
+
&_years{
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-items: center;
|
|
35
|
+
|
|
36
|
+
&--prev,
|
|
37
|
+
&--next{
|
|
38
|
+
color:#A6AAB4;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&-list{
|
|
43
|
+
position: relative;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
|
|
46
|
+
&::before,
|
|
47
|
+
&::after{
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
color: #3B414B;
|
|
52
|
+
height: 32px;
|
|
53
|
+
width: 90px;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
content: "0000";
|
|
56
|
+
background-color: red;
|
|
57
|
+
position: absolute;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&::before{
|
|
61
|
+
top: 0;
|
|
62
|
+
transform: translateY(-100%);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&::after{
|
|
66
|
+
bottom: 0;
|
|
67
|
+
transform: translateY(100%);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&--item{
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
color: #3B414B;
|
|
75
|
+
height: 32px;
|
|
76
|
+
width: 90px;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
|
|
79
|
+
&:not(.active){
|
|
80
|
+
transition: transform 1s;
|
|
81
|
+
}
|
|
82
|
+
&:not(.active)[attr-scroll-direction="1"]{
|
|
83
|
+
transform: translateY(25%);
|
|
84
|
+
}
|
|
85
|
+
&:not(.active)[attr-scroll-direction="-1"]{
|
|
86
|
+
transform: translateY(-25%);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:not(.active)[attr-is-scrolling="1"]{
|
|
90
|
+
opacity: 0.3;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
&.active{
|
|
95
|
+
background: #FFFFFF;
|
|
96
|
+
border: 1px solid #FFFFFF;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
box-shadow: 0px 4px 26px rgba(0, 67, 96, 0.1);
|
|
99
|
+
border-radius: 8px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&.transparent{
|
|
103
|
+
opacity: 0.5;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&_touch-zone{
|
|
108
|
+
top: 0;
|
|
109
|
+
left: 0;
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
position: absolute;
|
|
113
|
+
z-index: 5;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import MobileCalendar from './MobileCalendar';
|
|
3
|
+
|
|
4
|
+
global.lng = 'en';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Form Elements/Mobile Calendar',
|
|
8
|
+
component: MobileCalendar,
|
|
9
|
+
argTypes: {
|
|
10
|
+
value: {
|
|
11
|
+
description: 'string (mm.dd.yyyy)',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Template = (args) => {
|
|
17
|
+
const [date, setDate] = useState('');
|
|
18
|
+
|
|
19
|
+
return <MobileCalendar classes={{wrapper: "123"}} onChange={console.log}/>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const CalendarTemplate = Template.bind({});
|
|
23
|
+
|
|
24
|
+
CalendarTemplate.args = {
|
|
25
|
+
value: '',
|
|
26
|
+
minDate: '01/01/1900',
|
|
27
|
+
maxDate: '01/01/2100',
|
|
28
|
+
isDontLimitFuture: true,
|
|
29
|
+
// isListTop: true,
|
|
30
|
+
};
|