@cashub/ui 0.17.11 → 0.18.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/datetimePicker/DatePickerV2.js +135 -145
- package/datetimePicker/DatetimePickerV2.js +20 -52
- package/datetimePicker/accordion/Month.js +17 -14
- package/datetimePicker/accordion/Year.js +23 -17
- package/datetimePicker/utils/toUTC0.js +16 -0
- package/package.json +1 -1
- package/tagify/Tags.js +1 -1
|
@@ -15,6 +15,8 @@ var _reactOutsideClickHandler = _interopRequireDefault(require("react-outside-cl
|
|
|
15
15
|
|
|
16
16
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
17
|
|
|
18
|
+
var _md = require("react-icons/md");
|
|
19
|
+
|
|
18
20
|
var _hooks = require("@cashub/hooks");
|
|
19
21
|
|
|
20
22
|
var _utils = require("@cashub/utils");
|
|
@@ -29,11 +31,11 @@ var _Year = _interopRequireDefault(require("./accordion/Year"));
|
|
|
29
31
|
|
|
30
32
|
var _DateTimePickerContext = _interopRequireDefault(require("./subComponent/DateTimePickerContext"));
|
|
31
33
|
|
|
32
|
-
var
|
|
34
|
+
var _toUTC = _interopRequireDefault(require("./utils/toUTC0"));
|
|
33
35
|
|
|
34
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
37
|
|
|
36
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
38
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
37
39
|
|
|
38
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
41
|
|
|
@@ -69,11 +71,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
69
71
|
|
|
70
72
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
71
73
|
|
|
74
|
+
var DEFAULT_TIME = '00:00:00';
|
|
75
|
+
|
|
72
76
|
var DatePickerV2 = function DatePickerV2(_ref) {
|
|
73
77
|
var selected = _ref.selected,
|
|
74
78
|
fixedYear = _ref.fixedYear,
|
|
75
|
-
|
|
79
|
+
allowClear = _ref.allowClear,
|
|
76
80
|
minDate = _ref.minDate,
|
|
81
|
+
maxDate = _ref.maxDate,
|
|
77
82
|
onConfirm = _ref.onConfirm,
|
|
78
83
|
disabled = _ref.disabled;
|
|
79
84
|
|
|
@@ -85,17 +90,20 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
85
90
|
toggleElement = _useState2[0],
|
|
86
91
|
setToggleElement = _useState2[1];
|
|
87
92
|
|
|
88
|
-
var _useState3 = (0, _react.useState)(
|
|
93
|
+
var _useState3 = (0, _react.useState)(null),
|
|
89
94
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
contentElement = _useState4[0],
|
|
96
|
+
setContentElement = _useState4[1];
|
|
92
97
|
|
|
93
|
-
var _useState5 = (0, _react.useState)(
|
|
98
|
+
var _useState5 = (0, _react.useState)(function () {
|
|
99
|
+
var defaultDate = selected ? new Date(selected) : new Date();
|
|
100
|
+
return "".concat((0, _utils.formatDate)((0, _toUTC.default)(defaultDate), 'date'), " ").concat(DEFAULT_TIME);
|
|
101
|
+
}),
|
|
94
102
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
95
103
|
selectedDate = _useState6[0],
|
|
96
104
|
setSelectedDate = _useState6[1];
|
|
97
105
|
|
|
98
|
-
var _useState7 = (0, _react.useState)(selected ? (0, _utils.
|
|
106
|
+
var _useState7 = (0, _react.useState)(selected ? (0, _utils.formatDate)((0, _toUTC.default)(selected), 'date') : ''),
|
|
99
107
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
100
108
|
confirmDate = _useState8[0],
|
|
101
109
|
setConfirmDate = _useState8[1];
|
|
@@ -107,13 +115,24 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
107
115
|
|
|
108
116
|
var _useState11 = (0, _react.useState)(null),
|
|
109
117
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
accordionCurrentDisplayType = _useState12[0],
|
|
119
|
+
setAccordionCurrentDisplayType = _useState12[1];
|
|
112
120
|
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
121
|
+
var weeks = (0, _react.useMemo)(function () {
|
|
122
|
+
return ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(function (week) {
|
|
123
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Week, {
|
|
124
|
+
children: week
|
|
125
|
+
}, week);
|
|
126
|
+
});
|
|
127
|
+
}, []);
|
|
128
|
+
var minDateWithTime = (0, _react.useMemo)(function () {
|
|
129
|
+
if (!minDate) return;
|
|
130
|
+
return "".concat(minDate, " 00:00:00");
|
|
131
|
+
}, [minDate]);
|
|
132
|
+
var maxDateWithTime = (0, _react.useMemo)(function () {
|
|
133
|
+
if (!maxDate) return;
|
|
134
|
+
return "".concat(maxDate, " 00:00:00");
|
|
135
|
+
}, [maxDate]);
|
|
117
136
|
|
|
118
137
|
var _useCustomPopper = (0, _hooks.useCustomPopper)(toggleElement, contentElement, {
|
|
119
138
|
strategy: 'absolute',
|
|
@@ -125,14 +144,12 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
125
144
|
update = _useCustomPopper.update;
|
|
126
145
|
|
|
127
146
|
var context = {
|
|
128
|
-
|
|
147
|
+
fixedYear: fixedYear,
|
|
148
|
+
minDate: minDateWithTime,
|
|
149
|
+
maxDate: maxDateWithTime,
|
|
129
150
|
selectedDate: selectedDate,
|
|
130
151
|
setSelectedDate: setSelectedDate,
|
|
131
|
-
|
|
132
|
-
maxDate: maxDate,
|
|
133
|
-
fixedYear: fixedYear,
|
|
134
|
-
setAccordionCurrentDisplayType: setAccordionCurrentDisplayType,
|
|
135
|
-
setInputValue: setInputValue
|
|
152
|
+
setAccordionCurrentDisplayType: setAccordionCurrentDisplayType
|
|
136
153
|
};
|
|
137
154
|
|
|
138
155
|
var handleToggle = function handleToggle() {
|
|
@@ -140,49 +157,19 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
140
157
|
update();
|
|
141
158
|
};
|
|
142
159
|
|
|
143
|
-
var
|
|
160
|
+
var changeDisplayAccordion = (0, _react.useCallback)(function (type) {
|
|
144
161
|
if (accordionCurrentDisplayType === type) {
|
|
145
162
|
setAccordionCurrentDisplayType(null);
|
|
146
163
|
} else {
|
|
147
164
|
setAccordionCurrentDisplayType(type);
|
|
148
165
|
}
|
|
149
166
|
}, [accordionCurrentDisplayType]);
|
|
150
|
-
|
|
151
|
-
var handleChangeYear = function handleChangeYear(selected) {
|
|
152
|
-
var date = new Date(selectedDate);
|
|
153
|
-
|
|
154
|
-
if (selected === 'previous') {
|
|
155
|
-
if (date.getFullYear() > 1) {
|
|
156
|
-
date.setFullYear(date.getFullYear() - 1);
|
|
157
|
-
}
|
|
158
|
-
} else if (selected === 'next') {
|
|
159
|
-
date.setFullYear(date.getFullYear() + 1);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
setSelectedDate((0, _utils.datetimeTFormat)(date));
|
|
163
|
-
setAccordionCurrentDisplayType(null);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
var handleChangeMonth = function handleChangeMonth(selected) {
|
|
167
|
-
var date = new Date(selectedDate);
|
|
168
|
-
|
|
169
|
-
if (selected === 'previous') {
|
|
170
|
-
date.setMonth(date.getMonth() <= 0 ? 11 : date.getMonth() - 1);
|
|
171
|
-
} else if (selected === 'next') {
|
|
172
|
-
date.setMonth(date.getMonth() >= 11 ? 0 : date.getMonth() + 1);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
setSelectedDate((0, _utils.datetimeTFormat)(date));
|
|
176
|
-
setAccordionCurrentDisplayType(null);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
167
|
var handleConfirm = (0, _react.useCallback)(function () {
|
|
180
168
|
if (!confirmDate) return;
|
|
181
|
-
|
|
182
|
-
onConfirm("".concat(inputValue, " 00:00:00"));
|
|
169
|
+
onConfirm(confirmDate);
|
|
183
170
|
setDisplayPicker(false);
|
|
184
171
|
setAccordionCurrentDisplayType(null);
|
|
185
|
-
}, [confirmDate,
|
|
172
|
+
}, [confirmDate, onConfirm]);
|
|
186
173
|
var handleChangeDate = (0, _react.useCallback)(function (daysOfMonthForSelectedDate, firstWeekOfMonth, dayIndex, day) {
|
|
187
174
|
var date = new Date(selectedDate); // 先把日期設定成所有月分都有的日期,設定月份時才不會設定到非預期的date
|
|
188
175
|
|
|
@@ -208,8 +195,6 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
208
195
|
}
|
|
209
196
|
|
|
210
197
|
date.setDate(day);
|
|
211
|
-
setSelectedDate((0, _utils.datetimeTFormat)(date));
|
|
212
|
-
setConfirmDate((0, _utils.datetimeTFormat)(date));
|
|
213
198
|
} else if (fixedYear) {
|
|
214
199
|
if (dayIndex < firstWeekOfMonth) {
|
|
215
200
|
if (selectedMonth === 0) {
|
|
@@ -226,17 +211,20 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
226
211
|
}
|
|
227
212
|
|
|
228
213
|
date.setDate(day);
|
|
229
|
-
setSelectedDate((0, _utils.datetimeTFormat)(date));
|
|
230
|
-
setConfirmDate((0, _utils.datetimeTFormat)(date));
|
|
231
214
|
}
|
|
215
|
+
|
|
216
|
+
var formattedDate = (0, _utils.formatDate)(date, 'date');
|
|
217
|
+
setSelectedDate("".concat(formattedDate, " ").concat(DEFAULT_TIME));
|
|
218
|
+
setConfirmDate(formattedDate);
|
|
232
219
|
}, [fixedYear, selectedDate]);
|
|
233
|
-
var handleDisabled = (0, _react.useCallback)(function (
|
|
220
|
+
var handleDisabled = (0, _react.useCallback)(function (firstDayOfMonth, lastDayOfMonth, daysOfMonthForSelectedDate, dayIndex, day) {
|
|
234
221
|
var _selectedDate$split = selectedDate.split('-'),
|
|
235
222
|
_selectedDate$split2 = _slicedToArray(_selectedDate$split, 2),
|
|
236
223
|
year = _selectedDate$split2[0],
|
|
237
|
-
month = _selectedDate$split2[1];
|
|
224
|
+
month = _selectedDate$split2[1]; // disabled date before first month of first year
|
|
225
|
+
|
|
238
226
|
|
|
239
|
-
if (year === '0001' && month === '01' &&
|
|
227
|
+
if (year === '0001' && month === '01' && dayIndex < firstDayOfMonth) {
|
|
240
228
|
return true;
|
|
241
229
|
}
|
|
242
230
|
|
|
@@ -244,56 +232,61 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
244
232
|
if (myDay.length === 1) myDay = "0".concat(myDay);
|
|
245
233
|
|
|
246
234
|
if (fixedYear) {
|
|
247
|
-
if (month === '01'
|
|
248
|
-
// disabled date
|
|
249
|
-
return dayIndex <
|
|
250
|
-
} else if (month === '12'
|
|
235
|
+
if (month === '01') {
|
|
236
|
+
// disabled date before first month
|
|
237
|
+
return dayIndex < firstDayOfMonth;
|
|
238
|
+
} else if (month === '12') {
|
|
251
239
|
// disabled date in december
|
|
252
|
-
return dayIndex >= daysOfMonthForSelectedDate +
|
|
240
|
+
return dayIndex >= daysOfMonthForSelectedDate + firstDayOfMonth;
|
|
253
241
|
}
|
|
254
|
-
}
|
|
242
|
+
} // previous year's date
|
|
243
|
+
|
|
255
244
|
|
|
256
|
-
if (month === '01' &&
|
|
257
|
-
year =
|
|
258
|
-
}
|
|
259
|
-
|
|
245
|
+
if (month === '01' && firstDayOfMonth !== 0 && dayIndex + 1 <= firstDayOfMonth) {
|
|
246
|
+
year = +year - 1;
|
|
247
|
+
} // next year's date
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
if (month === '12' && lastDayOfMonth !== 6 && day + firstDayOfMonth < dayIndex + 1) {
|
|
251
|
+
year = +year + 1;
|
|
260
252
|
}
|
|
261
253
|
|
|
262
|
-
month =
|
|
254
|
+
month = firstDayOfMonth >= dayIndex + 1 ? +month - 1 : daysOfMonthForSelectedDate + firstDayOfMonth < dayIndex + 1 ? +month + 1 : +month;
|
|
263
255
|
|
|
264
|
-
if (month
|
|
256
|
+
if (month < 1) {
|
|
265
257
|
month = 12;
|
|
266
|
-
} else if (month
|
|
258
|
+
} else if (month > 12) {
|
|
267
259
|
month = 1;
|
|
268
260
|
}
|
|
269
261
|
|
|
270
|
-
|
|
262
|
+
month = month.toString();
|
|
263
|
+
|
|
264
|
+
if (month.length === 1) {
|
|
265
|
+
month = "0".concat(month);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
year = year.toString();
|
|
271
269
|
if (year.length === 1) year = "000".concat(year);
|
|
272
270
|
if (year.length === 2) year = "00".concat(year);
|
|
273
271
|
if (year.length === 3) year = "0".concat(year);
|
|
274
|
-
var
|
|
275
|
-
var compareMaxDateDate = (0, _utils.formatDate)((0, _utils.datetimeTFormat)(new Date((0, _GMTDate.default)((0, _utils.formatDate)(new Date("".concat(year, "-").concat(month, "-").concat(myDay))), 'date')).setHours(0, 0, 0, 0)));
|
|
272
|
+
var currentDate = "".concat(year, "-").concat(month, "-").concat(myDay, " ").concat(DEFAULT_TIME);
|
|
276
273
|
|
|
277
|
-
if (
|
|
274
|
+
if (minDateWithTime && currentDate < minDateWithTime) {
|
|
278
275
|
return true;
|
|
279
276
|
}
|
|
280
277
|
|
|
281
|
-
if (
|
|
282
|
-
return true;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (maxDate && minDate && (minDate > compareMinDateDate || maxDate < compareMaxDateDate)) {
|
|
278
|
+
if (maxDateWithTime && currentDate > maxDateWithTime) {
|
|
286
279
|
return true;
|
|
287
280
|
}
|
|
288
281
|
|
|
289
282
|
return false;
|
|
290
|
-
}, [fixedYear,
|
|
291
|
-
var
|
|
283
|
+
}, [fixedYear, minDateWithTime, maxDateWithTime, selectedDate]);
|
|
284
|
+
var isSelectedDay = (0, _react.useCallback)(function (day, index, firstDayOfMonth, daysOfMonthForSelectedDate) {
|
|
292
285
|
var selectedDateObj = new Date(selectedDate);
|
|
293
|
-
var confirmDateObj = new Date(confirmDate);
|
|
286
|
+
var confirmDateObj = (0, _toUTC.default)(new Date(confirmDate));
|
|
294
287
|
|
|
295
288
|
if (confirmDateObj.getFullYear() === selectedDateObj.getFullYear() && confirmDateObj.getMonth() === selectedDateObj.getMonth() && confirmDateObj.getDate() === day) {
|
|
296
|
-
if (index + 1 >
|
|
289
|
+
if (index + 1 > firstDayOfMonth && index < daysOfMonthForSelectedDate + firstDayOfMonth) {
|
|
297
290
|
return true;
|
|
298
291
|
}
|
|
299
292
|
|
|
@@ -302,36 +295,35 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
302
295
|
|
|
303
296
|
return false;
|
|
304
297
|
}, [selectedDate, confirmDate]);
|
|
305
|
-
|
|
298
|
+
|
|
299
|
+
var getLastDateOfMonth = function getLastDateOfMonth(selectedDate) {
|
|
306
300
|
var date = new Date(selectedDate); // 先把日期設定成所有月分都有的日期,設定月份時才不會設定到非預期的date
|
|
307
301
|
|
|
308
302
|
date.setDate(1);
|
|
309
303
|
date.setMonth(date.getMonth() + 1);
|
|
310
304
|
date.setDate(0);
|
|
311
|
-
|
|
312
|
-
|
|
305
|
+
return date;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
var days = (0, _react.useMemo)(function () {
|
|
309
|
+
var lastDateOfSelectedDate = getLastDateOfMonth(selectedDate);
|
|
310
|
+
var daysOfMonthForSelectedDate = lastDateOfSelectedDate.getDate();
|
|
311
|
+
var lastDayOfMonth = lastDateOfSelectedDate.getDay();
|
|
312
|
+
var date = new Date(selectedDate);
|
|
313
313
|
date.setMonth(date.getMonth() + 1 - 1);
|
|
314
314
|
date.setDate(0);
|
|
315
315
|
var daysOfPrevioueMonthForSelectedDate = date.getDate();
|
|
316
316
|
date = new Date(selectedDate); // 先把日期設定成所有月分都有的日期,設定月份時才不會設定到非預期的date
|
|
317
317
|
|
|
318
318
|
date.setDate(1);
|
|
319
|
-
var
|
|
320
|
-
date = new Date(selectedDate); // 先把日期設定成所有月分都有的日期,設定月份時才不會設定到非預期的date
|
|
321
|
-
|
|
322
|
-
date.setDate(1);
|
|
323
|
-
date.setMonth(date.getMonth() + 1);
|
|
324
|
-
date.setDate(0);
|
|
325
|
-
var lastWeekOfMonth = date.getDay();
|
|
326
|
-
var days = [];
|
|
319
|
+
var firstDayOfMonth = date.getDay();
|
|
327
320
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}
|
|
321
|
+
var days = _toConsumableArray(Array(daysOfMonthForSelectedDate)).map(function (value, index) {
|
|
322
|
+
return index + 1;
|
|
323
|
+
});
|
|
332
324
|
|
|
333
|
-
if (
|
|
334
|
-
for (var index = daysOfPrevioueMonthForSelectedDate; index > daysOfPrevioueMonthForSelectedDate -
|
|
325
|
+
if (firstDayOfMonth !== 0) {
|
|
326
|
+
for (var index = daysOfPrevioueMonthForSelectedDate; index > daysOfPrevioueMonthForSelectedDate - firstDayOfMonth; index -= 1) {
|
|
335
327
|
if (date.getFullYear() === 1 && date.getMonth() === 0) {
|
|
336
328
|
days.unshift(null);
|
|
337
329
|
} else {
|
|
@@ -340,50 +332,47 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
340
332
|
}
|
|
341
333
|
}
|
|
342
334
|
|
|
343
|
-
if (
|
|
344
|
-
for (var _index = 1; _index <= 6 -
|
|
335
|
+
if (lastDayOfMonth !== 6) {
|
|
336
|
+
for (var _index = 1; _index <= 6 - lastDayOfMonth; _index += 1) {
|
|
345
337
|
days.push(_index);
|
|
346
338
|
}
|
|
347
339
|
}
|
|
348
340
|
|
|
349
|
-
return days.map(function (day, index
|
|
341
|
+
return days.map(function (day, index) {
|
|
350
342
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Day, {
|
|
351
|
-
disabled: handleDisabled(
|
|
343
|
+
disabled: handleDisabled(firstDayOfMonth, lastDayOfMonth, daysOfMonthForSelectedDate, index, day),
|
|
352
344
|
onClick: function onClick() {
|
|
353
|
-
handleChangeDate(daysOfMonthForSelectedDate,
|
|
345
|
+
handleChangeDate(daysOfMonthForSelectedDate, firstDayOfMonth, index, day);
|
|
354
346
|
},
|
|
355
|
-
selected:
|
|
347
|
+
selected: isSelectedDay(day, index, firstDayOfMonth, daysOfMonthForSelectedDate),
|
|
356
348
|
children: day
|
|
357
349
|
}, index);
|
|
358
350
|
});
|
|
359
|
-
}, [selectedDate, handleChangeDate,
|
|
360
|
-
var weeks = (0, _react.useMemo)(function () {
|
|
361
|
-
return ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'].map(function (week) {
|
|
362
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Week, {
|
|
363
|
-
children: week
|
|
364
|
-
}, week);
|
|
365
|
-
});
|
|
366
|
-
}, []);
|
|
351
|
+
}, [selectedDate, handleChangeDate, isSelectedDay, handleDisabled]);
|
|
367
352
|
(0, _react.useEffect)(function () {
|
|
368
353
|
if (!selected) return;
|
|
369
|
-
|
|
370
|
-
|
|
354
|
+
var formattedDate = (0, _utils.formatDate)((0, _toUTC.default)(selected), 'date');
|
|
355
|
+
setSelectedDate("".concat(formattedDate, " ").concat(DEFAULT_TIME));
|
|
356
|
+
setConfirmDate(formattedDate);
|
|
371
357
|
}, [selected]);
|
|
372
|
-
(0, _react.useEffect)(function () {
|
|
373
|
-
if (!confirmDate) return;
|
|
374
|
-
setInputValue((0, _utils.formatDate)(confirmDate, 'date'));
|
|
375
|
-
}, [confirmDate]);
|
|
376
358
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DateTimePickerContext.default.Provider, {
|
|
377
359
|
value: context,
|
|
378
360
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactOutsideClickHandler.default, {
|
|
379
361
|
onOutsideClick: handleConfirm,
|
|
380
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
362
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
|
|
363
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Input.default, {
|
|
364
|
+
disabled: disabled,
|
|
365
|
+
ref: setToggleElement,
|
|
366
|
+
value: confirmDate,
|
|
367
|
+
onClick: handleToggle,
|
|
368
|
+
readOnly: true
|
|
369
|
+
}), confirmDate && !disabled && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(CloseButton, {
|
|
370
|
+
onClick: function onClick() {
|
|
371
|
+
setConfirmDate('');
|
|
372
|
+
onConfirm('');
|
|
373
|
+
}
|
|
374
|
+
})]
|
|
375
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Picker, _objectSpread(_objectSpread({}, attributes.popper), {}, {
|
|
387
376
|
style: styles.popper,
|
|
388
377
|
placement: state && state.placement,
|
|
389
378
|
ref: setContentElement,
|
|
@@ -391,16 +380,14 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
391
380
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Body, {
|
|
392
381
|
accordionCurrentDisplayType: accordionCurrentDisplayType,
|
|
393
382
|
children: [!fixedYear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Year.default, {
|
|
394
|
-
handleChangeTitle: handleChangeYear,
|
|
395
383
|
expand: accordionCurrentDisplayType === 'year',
|
|
396
384
|
handleDisplayAccordionContent: function handleDisplayAccordionContent() {
|
|
397
|
-
|
|
385
|
+
changeDisplayAccordion('year');
|
|
398
386
|
}
|
|
399
387
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Month.default, {
|
|
400
|
-
handleChangeTitle: handleChangeMonth,
|
|
401
388
|
expand: accordionCurrentDisplayType === 'month',
|
|
402
389
|
handleDisplayAccordionContent: function handleDisplayAccordionContent() {
|
|
403
|
-
|
|
390
|
+
changeDisplayAccordion('month');
|
|
404
391
|
},
|
|
405
392
|
confirmDate: confirmDate
|
|
406
393
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateContent, {
|
|
@@ -419,36 +406,39 @@ var DatePickerV2 = function DatePickerV2(_ref) {
|
|
|
419
406
|
});
|
|
420
407
|
};
|
|
421
408
|
|
|
422
|
-
var Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
409
|
+
var Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
410
|
+
|
|
411
|
+
var CloseButton = (0, _styledComponents.default)(_md.MdClose)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: var(--font-on-background);\n font-size: var(--font-body1);\n right: var(--spacing-s);\n cursor: pointer;\n"])));
|
|
412
|
+
CloseButton.displayName = 'CloseButton';
|
|
413
|
+
|
|
414
|
+
var Picker = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding-bottom: var(--spacing-s);\n background: var(--color-background1);\n border-radius: var(--border-radius);\n border: var(--border-width) solid var(--border-color);\n box-shadow: var(--box-shadow);\n overflow: hidden;\n width: 286px;\n z-index: 1;\n color: var(--font-on-background);\n\n display: ", ";\n"])), function (_ref2) {
|
|
423
415
|
var displayPicker = _ref2.displayPicker;
|
|
424
416
|
return displayPicker ? 'block' : 'none';
|
|
425
417
|
});
|
|
426
418
|
|
|
427
|
-
var Week = _styledComponents.default.div(
|
|
419
|
+
var Week = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: calc(100% / 7);\n height: 36px;\n border-radius: var(--border-radius-s);\n line-height: 36px;\n text-align: center;\n"])));
|
|
428
420
|
|
|
429
|
-
var Body = _styledComponents.default.div(
|
|
421
|
+
var Body = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", "\n\n overflow: hidden;\n padding: ", ";\n"])), function (_ref3) {
|
|
430
422
|
var accordionCurrentDisplayType = _ref3.accordionCurrentDisplayType;
|
|
431
|
-
return accordionCurrentDisplayType && (0, _styledComponents.css)(
|
|
423
|
+
return accordionCurrentDisplayType && (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: 216px;\n "])));
|
|
432
424
|
}, function (_ref4) {
|
|
433
425
|
var accordionCurrentDisplayType = _ref4.accordionCurrentDisplayType;
|
|
434
426
|
return accordionCurrentDisplayType === 'year' ? ' 0 4px var(--spacing-s) var(--spacing-s)' : '0 var(--spacing-s) 0 var(--spacing-s)';
|
|
435
427
|
});
|
|
436
428
|
|
|
437
|
-
var Footer = _styledComponents.default.div(
|
|
438
|
-
|
|
439
|
-
var PickerInput = (0, _styledComponents.default)(_Input.default)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n &:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n"])));
|
|
429
|
+
var Footer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding: 0 var(--spacing-s);\n"])));
|
|
440
430
|
|
|
441
|
-
var Day = _styledComponents.default.button(
|
|
431
|
+
var Day = _styledComponents.default.button(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: calc(100% / 7);\n height: 36px;\n border-radius: var(--border-radius-s);\n line-height: 36px;\n text-align: center;\n padding: 0;\n border: 0;\n background: var(--color-background1);\n color: var(--font-on-background);\n &:hover {\n background: var(--color-primary);\n }\n\n ", "\n\n ", "\n"])), function (_ref5) {
|
|
442
432
|
var selected = _ref5.selected;
|
|
443
433
|
return selected && 'background: var(--color-hover);';
|
|
444
434
|
}, function (_ref6) {
|
|
445
435
|
var disabled = _ref6.disabled;
|
|
446
|
-
return disabled && (0, _styledComponents.css)(
|
|
436
|
+
return disabled && (0, _styledComponents.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n color: var(--font-on-mute);\n background: none;\n &:hover {\n background: none;\n }\n "])));
|
|
447
437
|
});
|
|
448
438
|
|
|
449
|
-
var ConfirmButton = (0, _styledComponents.default)(_Button.default)(
|
|
439
|
+
var ConfirmButton = (0, _styledComponents.default)(_Button.default)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n margin: 16px auto 0;\n"])));
|
|
450
440
|
|
|
451
|
-
var DateContent = _styledComponents.default.div(
|
|
441
|
+
var DateContent = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n"])));
|
|
452
442
|
|
|
453
443
|
var _default = DatePickerV2;
|
|
454
444
|
exports.default = _default;
|
|
@@ -74,8 +74,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
74
74
|
var DatetimePickerV2 = function DatetimePickerV2(_ref) {
|
|
75
75
|
var selected = _ref.selected,
|
|
76
76
|
fixedYear = _ref.fixedYear,
|
|
77
|
-
maxDate = _ref.maxDate,
|
|
78
77
|
minDate = _ref.minDate,
|
|
78
|
+
maxDate = _ref.maxDate,
|
|
79
79
|
onConfirm = _ref.onConfirm,
|
|
80
80
|
disabled = _ref.disabled,
|
|
81
81
|
onBlur = _ref.onBlur;
|
|
@@ -88,30 +88,30 @@ var DatetimePickerV2 = function DatetimePickerV2(_ref) {
|
|
|
88
88
|
toggleElement = _useState2[0],
|
|
89
89
|
setToggleElement = _useState2[1];
|
|
90
90
|
|
|
91
|
-
var _useState3 = (0, _react.useState)(
|
|
91
|
+
var _useState3 = (0, _react.useState)(null),
|
|
92
92
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
contentElement = _useState4[0],
|
|
94
|
+
setContentElement = _useState4[1];
|
|
95
95
|
|
|
96
|
-
var _useState5 = (0, _react.useState)(selected ? (0, _utils.datetimeTFormat)(
|
|
96
|
+
var _useState5 = (0, _react.useState)(selected ? (0, _utils.datetimeTFormat)(selected) : ''),
|
|
97
97
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
inputValue = _useState6[0],
|
|
99
|
+
setInputValue = _useState6[1];
|
|
100
100
|
|
|
101
|
-
var _useState7 = (0, _react.useState)(selected ? (0, _utils.datetimeTFormat)(selected) :
|
|
101
|
+
var _useState7 = (0, _react.useState)(selected ? (0, _utils.datetimeTFormat)((0, _GMTDate.default)(selected)) : (0, _utils.datetimeTFormat)((0, _GMTDate.default)(new Date()))),
|
|
102
102
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
selectedDate = _useState8[0],
|
|
104
|
+
setSelectedDate = _useState8[1];
|
|
105
105
|
|
|
106
|
-
var _useState9 = (0, _react.useState)(
|
|
106
|
+
var _useState9 = (0, _react.useState)(selected ? (0, _utils.datetimeTFormat)(selected) : ''),
|
|
107
107
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
confirmDate = _useState10[0],
|
|
109
|
+
setConfirmDate = _useState10[1];
|
|
110
110
|
|
|
111
|
-
var _useState11 = (0, _react.useState)(
|
|
111
|
+
var _useState11 = (0, _react.useState)(false),
|
|
112
112
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
displayPicker = _useState12[0],
|
|
114
|
+
setDisplayPicker = _useState12[1];
|
|
115
115
|
|
|
116
116
|
var _useState13 = (0, _react.useState)(function () {
|
|
117
117
|
var date = new Date((0, _utils.datetimeTFormat)(selected ? selected : (0, _utils.formatDate)(new Date())));
|
|
@@ -137,14 +137,12 @@ var DatetimePickerV2 = function DatetimePickerV2(_ref) {
|
|
|
137
137
|
update = _useCustomPopper.update;
|
|
138
138
|
|
|
139
139
|
var context = {
|
|
140
|
-
|
|
141
|
-
selectedDate: selectedDate,
|
|
142
|
-
setSelectedDate: setSelectedDate,
|
|
140
|
+
fixedYear: fixedYear,
|
|
143
141
|
minDate: minDate,
|
|
144
142
|
maxDate: maxDate,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
selectedDate: selectedDate,
|
|
144
|
+
setSelectedDate: setSelectedDate,
|
|
145
|
+
setAccordionCurrentDisplayType: setAccordionCurrentDisplayType
|
|
148
146
|
};
|
|
149
147
|
|
|
150
148
|
var handleToggle = function handleToggle() {
|
|
@@ -164,34 +162,6 @@ var DatetimePickerV2 = function DatetimePickerV2(_ref) {
|
|
|
164
162
|
}
|
|
165
163
|
}, [accordionCurrentDisplayType]);
|
|
166
164
|
|
|
167
|
-
var handleChangeYear = function handleChangeYear(selected) {
|
|
168
|
-
var date = new Date(selectedDate);
|
|
169
|
-
|
|
170
|
-
if (selected === 'previous') {
|
|
171
|
-
if (date.getFullYear() > 1) {
|
|
172
|
-
date.setFullYear(date.getFullYear() - 1);
|
|
173
|
-
}
|
|
174
|
-
} else if (selected === 'next') {
|
|
175
|
-
date.setFullYear(date.getFullYear() + 1);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
setSelectedDate((0, _utils.datetimeTFormat)(date));
|
|
179
|
-
setAccordionCurrentDisplayType(null);
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
var handleChangeMonth = function handleChangeMonth(selected) {
|
|
183
|
-
var date = new Date(selectedDate);
|
|
184
|
-
|
|
185
|
-
if (selected === 'previous') {
|
|
186
|
-
date.setMonth(date.getMonth() <= 0 ? 11 : date.getMonth() - 1);
|
|
187
|
-
} else if (selected === 'next') {
|
|
188
|
-
date.setMonth(date.getMonth() >= 11 ? 0 : date.getMonth() + 1);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
setSelectedDate((0, _utils.datetimeTFormat)(date));
|
|
192
|
-
setAccordionCurrentDisplayType(null);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
165
|
var handleConfirm = (0, _react.useCallback)(function () {
|
|
196
166
|
if (!confirmDate) return;
|
|
197
167
|
setSelectedDate(confirmDate);
|
|
@@ -419,13 +389,11 @@ var DatetimePickerV2 = function DatetimePickerV2(_ref) {
|
|
|
419
389
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Body, {
|
|
420
390
|
accordionCurrentDisplayType: accordionCurrentDisplayType,
|
|
421
391
|
children: [!fixedYear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Year.default, {
|
|
422
|
-
handleChangeTitle: handleChangeYear,
|
|
423
392
|
expand: accordionCurrentDisplayType === 'year',
|
|
424
393
|
handleDisplayAccordionContent: function handleDisplayAccordionContent() {
|
|
425
394
|
_handleDisplayAccordionContent('year');
|
|
426
395
|
}
|
|
427
396
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Month.default, {
|
|
428
|
-
handleChangeTitle: handleChangeMonth,
|
|
429
397
|
expand: accordionCurrentDisplayType === 'month',
|
|
430
398
|
handleDisplayAccordionContent: function handleDisplayAccordionContent() {
|
|
431
399
|
_handleDisplayAccordionContent('month');
|
|
@@ -35,8 +35,7 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
35
35
|
|
|
36
36
|
var Month = function Month(_ref) {
|
|
37
37
|
var expand = _ref.expand,
|
|
38
|
-
handleDisplayAccordionContent = _ref.handleDisplayAccordionContent
|
|
39
|
-
handleChangeTitle = _ref.handleChangeTitle;
|
|
38
|
+
handleDisplayAccordionContent = _ref.handleDisplayAccordionContent;
|
|
40
39
|
|
|
41
40
|
var _useContext = (0, _react.useContext)(_DateTimePickerContext.default),
|
|
42
41
|
selectedDate = _useContext.selectedDate,
|
|
@@ -47,14 +46,22 @@ var Month = function Month(_ref) {
|
|
|
47
46
|
setAccordionCurrentDisplayType = _useContext.setAccordionCurrentDisplayType;
|
|
48
47
|
|
|
49
48
|
var handleChangeMonth = (0, _react.useCallback)(function (month) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
date.setMonth(month);
|
|
54
|
-
return (0, _utils.datetimeTFormat)(date);
|
|
55
|
-
});
|
|
49
|
+
var date = new Date(selectedDate);
|
|
50
|
+
date.setMonth(month);
|
|
51
|
+
setSelectedDate((0, _utils.datetimeTFormat)(date));
|
|
56
52
|
setAccordionCurrentDisplayType(null);
|
|
57
53
|
}, [setAccordionCurrentDisplayType, setSelectedDate, selectedDate]);
|
|
54
|
+
|
|
55
|
+
var changeToPreviousMonth = function changeToPreviousMonth() {
|
|
56
|
+
var date = new Date(selectedDate);
|
|
57
|
+
handleChangeMonth(date.getMonth() <= 0 ? 11 : date.getMonth() - 1);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var changeToNextMonth = function changeToNextMonth() {
|
|
61
|
+
var date = new Date(selectedDate);
|
|
62
|
+
handleChangeMonth(date.getMonth() >= 11 ? 0 : date.getMonth() + 1);
|
|
63
|
+
};
|
|
64
|
+
|
|
58
65
|
var handleMonthItemDisable = (0, _react.useCallback)(function (month) {
|
|
59
66
|
var minDayDate;
|
|
60
67
|
var maxDayDate;
|
|
@@ -129,17 +136,13 @@ var Month = function Month(_ref) {
|
|
|
129
136
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
130
137
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Header, {
|
|
131
138
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
|
|
132
|
-
onClick:
|
|
133
|
-
handleChangeTitle('previous');
|
|
134
|
-
},
|
|
139
|
+
onClick: changeToPreviousMonth,
|
|
135
140
|
disabled: handleDisableArrow('previous'),
|
|
136
141
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdArrowBackIosNew, {})
|
|
137
142
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
138
143
|
children: _constant.MONTH[new Date(selectedDate).getMonth()].text
|
|
139
144
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
|
|
140
|
-
onClick:
|
|
141
|
-
handleChangeTitle('next');
|
|
142
|
-
},
|
|
145
|
+
onClick: changeToNextMonth,
|
|
143
146
|
disabled: handleDisableArrow('next'),
|
|
144
147
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdArrowForwardIos, {})
|
|
145
148
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
|
|
@@ -55,15 +55,14 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
55
55
|
|
|
56
56
|
var Year = function Year(_ref) {
|
|
57
57
|
var expand = _ref.expand,
|
|
58
|
-
handleDisplayAccordionContent = _ref.handleDisplayAccordionContent
|
|
59
|
-
handleChangeTitle = _ref.handleChangeTitle;
|
|
58
|
+
handleDisplayAccordionContent = _ref.handleDisplayAccordionContent;
|
|
60
59
|
|
|
61
60
|
var _useContext = (0, _react.useContext)(_DateTimePickerContext.default),
|
|
62
|
-
|
|
63
|
-
setSelectedDate = _useContext.setSelectedDate,
|
|
61
|
+
fixedYear = _useContext.fixedYear,
|
|
64
62
|
minDate = _useContext.minDate,
|
|
65
63
|
maxDate = _useContext.maxDate,
|
|
66
|
-
|
|
64
|
+
selectedDate = _useContext.selectedDate,
|
|
65
|
+
setSelectedDate = _useContext.setSelectedDate,
|
|
67
66
|
setAccordionCurrentDisplayType = _useContext.setAccordionCurrentDisplayType;
|
|
68
67
|
|
|
69
68
|
var bodyRef = (0, _react.useRef)(null);
|
|
@@ -77,11 +76,22 @@ var Year = function Year(_ref) {
|
|
|
77
76
|
var minYear = minDate ? new Date((0, _utils.datetimeTFormat)(minDate)).getFullYear() : 1;
|
|
78
77
|
var maxYear = maxDate ? new Date((0, _utils.datetimeTFormat)(maxDate)).getFullYear() : null;
|
|
79
78
|
var handleChangeYear = (0, _react.useCallback)(function (year) {
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
setSelectedDate((0, _utils.datetimeTFormat)(
|
|
79
|
+
var date = new Date(selectedDate);
|
|
80
|
+
date.setFullYear(year);
|
|
81
|
+
setSelectedDate((0, _utils.datetimeTFormat)(date));
|
|
83
82
|
setAccordionCurrentDisplayType(null);
|
|
84
83
|
}, [selectedDate, setAccordionCurrentDisplayType, setSelectedDate]);
|
|
84
|
+
var changeToPreviousYear = (0, _react.useCallback)(function () {
|
|
85
|
+
var date = new Date(selectedDate);
|
|
86
|
+
|
|
87
|
+
if (date.getFullYear() > 1) {
|
|
88
|
+
handleChangeYear(date.getFullYear() - 1);
|
|
89
|
+
}
|
|
90
|
+
}, [selectedDate, handleChangeYear]);
|
|
91
|
+
var changeToNextYear = (0, _react.useCallback)(function () {
|
|
92
|
+
var date = new Date(selectedDate);
|
|
93
|
+
handleChangeYear(date.getFullYear() + 1);
|
|
94
|
+
}, [selectedDate, handleChangeYear]);
|
|
85
95
|
var handleYearItemDisable = (0, _react.useCallback)(function (year) {
|
|
86
96
|
if (minDate !== undefined && maxDate !== undefined) {
|
|
87
97
|
return !(minYear <= year && year <= maxYear);
|
|
@@ -182,17 +192,13 @@ var Year = function Year(_ref) {
|
|
|
182
192
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
183
193
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Header, {
|
|
184
194
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
|
|
185
|
-
onClick:
|
|
186
|
-
handleChangeTitle('previous');
|
|
187
|
-
},
|
|
195
|
+
onClick: changeToPreviousYear,
|
|
188
196
|
disabled: handleDisableArrow('previous'),
|
|
189
197
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdArrowBackIosNew, {})
|
|
190
198
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
191
199
|
children: new Date(selectedDate).getFullYear()
|
|
192
200
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
|
|
193
|
-
onClick:
|
|
194
|
-
handleChangeTitle('next');
|
|
195
|
-
},
|
|
201
|
+
onClick: changeToNextYear,
|
|
196
202
|
disabled: handleDisableArrow('next'),
|
|
197
203
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdArrowForwardIos, {})
|
|
198
204
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, {
|
|
@@ -221,12 +227,12 @@ var IconButton = _styledComponents.default.button(_templateObject2 || (_template
|
|
|
221
227
|
return right && "\n position: absolute;\n right: 0;\n ".concat(rotate && (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transform: rotate(180deg);\n "]))), "\n ");
|
|
222
228
|
});
|
|
223
229
|
|
|
224
|
-
var Body = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex-wrap: wrap;\n height: 0;\n width: 100%;\n display: ", ";\n
|
|
230
|
+
var Body = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex-wrap: wrap;\n height: 0;\n width: 100%;\n display: ", ";\n transition: 0.3s;\n overflow-y: scroll;\n gap: 12px 0;\n ", "\n\n ", "\n"])), function (_ref4) {
|
|
225
231
|
var expand = _ref4.expand;
|
|
226
232
|
return expand ? 'flex' : 'none';
|
|
227
|
-
}, function (_ref5) {
|
|
233
|
+
}, _scrollbar.default, function (_ref5) {
|
|
228
234
|
var fixedYear = _ref5.fixedYear;
|
|
229
|
-
return (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n
|
|
235
|
+
return (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px};\n "])), fixedYear ? '144' : '192');
|
|
230
236
|
});
|
|
231
237
|
|
|
232
238
|
var Item = _styledComponents.default.button(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n width: calc(100% / 3);\n height: 36px;\n line-height: 36px;\n text-align: center;\n border-radius: var(--border-radius-s);\n padding: 0;\n border: none;\n color: var(--font-on-background);\n background: var(--color-background1);\n\n &:hover {\n ", "\n }\n\n ", "\n\n ", "\n"])), function (_ref6) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var toUTC0 = function toUTC0(date) {
|
|
9
|
+
if (!date) return;
|
|
10
|
+
var newDate = new Date(date);
|
|
11
|
+
newDate.setTime(newDate.getTime() + newDate.getTimezoneOffset() * 60 * 1000);
|
|
12
|
+
return newDate;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var _default = toUTC0;
|
|
16
|
+
exports.default = _default;
|
package/package.json
CHANGED
package/tagify/Tags.js
CHANGED
|
@@ -49,7 +49,7 @@ var Tags = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
var Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .tagify {\n --tags-disabled-bg: var(--font-on-mute);\n --tags-border-color: var(--border-color);\n --tags-hover-border-color: var(--border-color);\n --tags-focus-border-color: var(--color-primary);\n --tag-invalid-color: var(--color-danger);\n --tag-remove-btn-bg--hover: var(--color-danger);\n --input-color: var(--font-on-background);\n
|
|
52
|
+
var Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .tagify[readonly]:not(.tagify--mix):not(.tagify--select) {\n opacity: 0.5;\n }\n .tagify {\n --tags-disabled-bg: var(--font-on-mute);\n --tags-border-color: var(--border-color);\n --tags-hover-border-color: var(--border-color);\n --tags-focus-border-color: var(--color-primary);\n --tag-invalid-color: var(--color-danger);\n --tag-remove-btn-bg--hover: var(--color-danger);\n --input-color: var(--font-on-background);\n\n border-radius: var(--border-radius-l);\n width: 100%;\n\n .tagify__tag {\n > div::before {\n border-radius: var(--border-radius-l);\n }\n }\n }\n"])));
|
|
53
53
|
|
|
54
54
|
var _default = Tags;
|
|
55
55
|
exports.default = _default;
|