@alfalab/core-components-calendar-range 7.0.28 → 7.0.30
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/Component.js +2 -1
- package/components/divider/Component.js +1 -1
- package/components/divider/index.css +8 -8
- package/cssm/Component.js +1 -0
- package/cssm/index.js +1 -0
- package/cssm/views/popover.js +11 -6
- package/cssm/views/static.js +8 -6
- package/esm/Component.js +2 -1
- package/esm/components/divider/Component.js +1 -1
- package/esm/components/divider/index.css +8 -8
- package/esm/index.js +2 -1
- package/esm/index.module-0d4b1792.js +4 -0
- package/esm/views/index.css +6 -6
- package/esm/views/popover.js +12 -7
- package/esm/views/static.js +9 -7
- package/index.js +2 -1
- package/index.module-1acef89e.js +6 -0
- package/modern/Component.js +2 -1
- package/modern/components/divider/Component.js +1 -1
- package/modern/components/divider/index.css +8 -8
- package/modern/index.js +2 -1
- package/modern/index.module-43648a9b.js +4 -0
- package/modern/views/index.css +6 -6
- package/modern/views/popover.js +10 -7
- package/modern/views/static.js +9 -7
- package/package.json +5 -4
- package/views/index.css +6 -6
- package/views/popover.js +12 -7
- package/views/static.js +9 -7
- package/esm/index.module-b1d3d41f.js +0 -4
- package/index.module-3b916d55.js +0 -6
- package/modern/index.module-f3b17214.js +0 -4
package/Component.js
CHANGED
|
@@ -10,6 +10,7 @@ require('classnames');
|
|
|
10
10
|
require('date-fns/startOfMonth');
|
|
11
11
|
require('@alfalab/core-components-calendar-input');
|
|
12
12
|
require('@alfalab/core-components-date-input');
|
|
13
|
+
require('@alfalab/hooks');
|
|
13
14
|
require('./components/divider/Component.js');
|
|
14
15
|
require('./hooks.js');
|
|
15
16
|
require('date-fns/addMonths');
|
|
@@ -17,7 +18,7 @@ require('date-fns/isEqual');
|
|
|
17
18
|
require('date-fns/max');
|
|
18
19
|
require('date-fns/min');
|
|
19
20
|
require('date-fns/subMonths');
|
|
20
|
-
require('./index.module-
|
|
21
|
+
require('./index.module-1acef89e.js');
|
|
21
22
|
require('date-fns/endOfMonth');
|
|
22
23
|
require('date-fns/isSameMonth');
|
|
23
24
|
require('@alfalab/core-components-calendar');
|
|
@@ -10,7 +10,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
11
11
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
12
12
|
|
|
13
|
-
var styles = {"component":"calendar-
|
|
13
|
+
var styles = {"component":"calendar-range__component_1wax4","outer":"calendar-range__outer_1wax4","s":"calendar-range__s_1wax4","m":"calendar-range__m_1wax4","l":"calendar-range__l_1wax4","xl":"calendar-range__xl_1wax4"};
|
|
14
14
|
require('./index.css')
|
|
15
15
|
|
|
16
16
|
var Divider = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1e4hm */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-primary: #0e0e0e; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -41,29 +41,29 @@
|
|
|
41
41
|
/* disabled */
|
|
42
42
|
|
|
43
43
|
/* marker */
|
|
44
|
-
} .calendar-
|
|
44
|
+
} .calendar-range__component_1wax4 {
|
|
45
45
|
display: flex;
|
|
46
46
|
align-items: center;
|
|
47
47
|
justify-content: center;
|
|
48
48
|
width: 16px;
|
|
49
49
|
margin: 0 var(--gap-xs)
|
|
50
|
-
} .calendar-
|
|
50
|
+
} .calendar-range__component_1wax4:after {
|
|
51
51
|
content: '';
|
|
52
52
|
display: block;
|
|
53
53
|
width: 100%;
|
|
54
54
|
height: 1px;
|
|
55
55
|
background-color: var(--color-light-graphic-primary);
|
|
56
|
-
} .calendar-
|
|
56
|
+
} .calendar-range__outer_1wax4 {
|
|
57
57
|
position: relative;
|
|
58
58
|
|
|
59
59
|
/* FormControl .above height + margin-bottom */
|
|
60
60
|
top: 24px;
|
|
61
|
-
} .calendar-
|
|
61
|
+
} .calendar-range__s_1wax4 {
|
|
62
62
|
height: var(--size-s-height);
|
|
63
|
-
} .calendar-
|
|
63
|
+
} .calendar-range__m_1wax4 {
|
|
64
64
|
height: var(--size-m-height);
|
|
65
|
-
} .calendar-
|
|
65
|
+
} .calendar-range__l_1wax4 {
|
|
66
66
|
height: var(--size-l-height);
|
|
67
|
-
} .calendar-
|
|
67
|
+
} .calendar-range__xl_1wax4 {
|
|
68
68
|
height: var(--size-xl-height);
|
|
69
69
|
}
|
package/cssm/Component.js
CHANGED
|
@@ -10,6 +10,7 @@ require('classnames');
|
|
|
10
10
|
require('date-fns/startOfMonth');
|
|
11
11
|
require('@alfalab/core-components-calendar-input/cssm');
|
|
12
12
|
require('@alfalab/core-components-date-input/cssm');
|
|
13
|
+
require('@alfalab/hooks');
|
|
13
14
|
require('./components/divider/Component.js');
|
|
14
15
|
require('./components/divider/index.module.css');
|
|
15
16
|
require('./hooks.js');
|
package/cssm/index.js
CHANGED
|
@@ -10,6 +10,7 @@ require('classnames');
|
|
|
10
10
|
require('date-fns/startOfMonth');
|
|
11
11
|
require('@alfalab/core-components-calendar-input/cssm');
|
|
12
12
|
require('@alfalab/core-components-date-input/cssm');
|
|
13
|
+
require('@alfalab/hooks');
|
|
13
14
|
require('./components/divider/Component.js');
|
|
14
15
|
require('./components/divider/index.module.css');
|
|
15
16
|
require('./hooks.js');
|
package/cssm/views/popover.js
CHANGED
|
@@ -8,6 +8,7 @@ var cn = require('classnames');
|
|
|
8
8
|
var startOfMonth = require('date-fns/startOfMonth');
|
|
9
9
|
var coreComponentsCalendarInput = require('@alfalab/core-components-calendar-input/cssm');
|
|
10
10
|
var coreComponentsDateInput = require('@alfalab/core-components-date-input/cssm');
|
|
11
|
+
var hooks$1 = require('@alfalab/hooks');
|
|
11
12
|
var components_divider_Component = require('../components/divider/Component.js');
|
|
12
13
|
var hooks = require('../hooks.js');
|
|
13
14
|
var styles = require('./index.module.css');
|
|
@@ -60,12 +61,16 @@ var CalendarRangePopover = function (_a) {
|
|
|
60
61
|
setInputToInvalid(inputToValue !== '' &&
|
|
61
62
|
!coreComponentsCalendarInput.isValidInputValue(inputToValue, dateFrom || minDate, maxDate, offDays));
|
|
62
63
|
}, [dateFrom, inputToValue, maxDate, minDate, offDays]);
|
|
63
|
-
var handleInputFromChange =
|
|
64
|
+
var handleInputFromChange = function (event, payload) {
|
|
65
|
+
var _a;
|
|
64
66
|
setInputFromValue(payload.value);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
(_a = inputFromProps.onInputChange) === null || _a === void 0 ? void 0 : _a.call(inputFromProps, event, payload);
|
|
68
|
+
};
|
|
69
|
+
var handleInputToChange = function (event, payload) {
|
|
70
|
+
var _a;
|
|
67
71
|
setInputToValue(payload.value);
|
|
68
|
-
|
|
72
|
+
(_a = inputToProps.onInputChange) === null || _a === void 0 ? void 0 : _a.call(inputToProps, event, payload);
|
|
73
|
+
};
|
|
69
74
|
var handleInputFromBlur = React.useCallback(function () {
|
|
70
75
|
handleValidInputFrom();
|
|
71
76
|
setResetKey(+new Date());
|
|
@@ -86,7 +91,7 @@ var CalendarRangePopover = function (_a) {
|
|
|
86
91
|
React.useEffect(function () {
|
|
87
92
|
setInputToValue(valueTo);
|
|
88
93
|
}, [valueTo]);
|
|
89
|
-
|
|
94
|
+
hooks$1.useDidUpdateEffect(function () {
|
|
90
95
|
onDateFromChange({ value: inputFromValue, date: dateFrom });
|
|
91
96
|
onChange({
|
|
92
97
|
valueFrom: inputFromValue,
|
|
@@ -99,7 +104,7 @@ var CalendarRangePopover = function (_a) {
|
|
|
99
104
|
}
|
|
100
105
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
106
|
}, [inputFromValue]);
|
|
102
|
-
|
|
107
|
+
hooks$1.useDidUpdateEffect(function () {
|
|
103
108
|
onDateToChange({ value: inputToValue, date: dateTo });
|
|
104
109
|
onChange({
|
|
105
110
|
valueFrom: inputFromValue,
|
package/cssm/views/static.js
CHANGED
|
@@ -60,6 +60,8 @@ var CalendarRangeStatic = function (_a) {
|
|
|
60
60
|
var _p = React.useState(coreComponentsDateInput.isCompleteDateInput(inputFromValue) && dateFrom === null), inputFromInvalid = _p[0], setInputFromInvalid = _p[1];
|
|
61
61
|
var _q = React.useState(coreComponentsDateInput.isCompleteDateInput(inputToValue) && dateTo === null), inputToInvalid = _q[0], setInputToInvalid = _q[1];
|
|
62
62
|
var hasValidateError = bothInvalid || inputFromInvalid || inputToInvalid;
|
|
63
|
+
var calendarFromProps = inputFromProps.calendarProps, onInputChangeFrom = inputFromProps.onInputChange, dateInputFromProps = tslib.__rest(inputFromProps, ["calendarProps", "onInputChange"]);
|
|
64
|
+
var calendarToProps = inputToProps.calendarProps, onInputChangeTo = inputToProps.onInputChange, dateInputToProps = tslib.__rest(inputToProps, ["calendarProps", "onInputChange"]);
|
|
63
65
|
var _r = hooks.useStaticViewMonthes({
|
|
64
66
|
selectedFrom: period.selectedFrom,
|
|
65
67
|
selectedTo: period.selectedTo,
|
|
@@ -72,12 +74,14 @@ var CalendarRangeStatic = function (_a) {
|
|
|
72
74
|
var handleValidInputTo = React.useCallback(function () {
|
|
73
75
|
setInputToInvalid(inputToValue !== '' && !validateInputToValue(inputToValue));
|
|
74
76
|
}, [inputToValue, validateInputToValue]);
|
|
75
|
-
var handleInputFromChange =
|
|
77
|
+
var handleInputFromChange = function (event, payload) {
|
|
76
78
|
setInputFromValue(payload.value);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
onInputChangeFrom === null || onInputChangeFrom === void 0 ? void 0 : onInputChangeFrom(event, payload);
|
|
80
|
+
};
|
|
81
|
+
var handleInputToChange = function (event, payload) {
|
|
79
82
|
setInputToValue(payload.value);
|
|
80
|
-
|
|
83
|
+
onInputChangeTo === null || onInputChangeTo === void 0 ? void 0 : onInputChangeTo(event, payload);
|
|
84
|
+
};
|
|
81
85
|
var handleMouseOver = React.useCallback(function (event) {
|
|
82
86
|
var target = event.target;
|
|
83
87
|
var mouseOverDayButton = utils.isDayButton(target) || utils.isDayButton(target.parentElement);
|
|
@@ -159,8 +163,6 @@ var CalendarRangeStatic = function (_a) {
|
|
|
159
163
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
164
|
}, [hasValidateError]);
|
|
161
165
|
var rangeProps = hooks.useSelectionProps(period.selectedFrom, period.selectedTo, highlightedDate);
|
|
162
|
-
var calendarFromProps = inputFromProps.calendarProps, dateInputFromProps = tslib.__rest(inputFromProps, ["calendarProps"]);
|
|
163
|
-
var calendarToProps = inputToProps.calendarProps, dateInputToProps = tslib.__rest(inputToProps, ["calendarProps"]);
|
|
164
166
|
var CalendarFromComponent = dateInputFromProps.Calendar || coreComponentsCalendar.Calendar;
|
|
165
167
|
var CalendarToComponent = dateInputToProps.Calendar || coreComponentsCalendar.Calendar;
|
|
166
168
|
var minMaxInSameMonth = minDate && maxDate && isSameMonth__default.default(minDate, maxDate);
|
package/esm/Component.js
CHANGED
|
@@ -6,6 +6,7 @@ import 'classnames';
|
|
|
6
6
|
import 'date-fns/startOfMonth';
|
|
7
7
|
import '@alfalab/core-components-calendar-input/esm';
|
|
8
8
|
import '@alfalab/core-components-date-input/esm';
|
|
9
|
+
import '@alfalab/hooks';
|
|
9
10
|
import './components/divider/Component.js';
|
|
10
11
|
import './hooks.js';
|
|
11
12
|
import 'date-fns/addMonths';
|
|
@@ -13,7 +14,7 @@ import 'date-fns/isEqual';
|
|
|
13
14
|
import 'date-fns/max';
|
|
14
15
|
import 'date-fns/min';
|
|
15
16
|
import 'date-fns/subMonths';
|
|
16
|
-
import './index.module-
|
|
17
|
+
import './index.module-0d4b1792.js';
|
|
17
18
|
import 'date-fns/endOfMonth';
|
|
18
19
|
import 'date-fns/isSameMonth';
|
|
19
20
|
import '@alfalab/core-components-calendar/esm';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
var styles = {"component":"calendar-
|
|
4
|
+
var styles = {"component":"calendar-range__component_1wax4","outer":"calendar-range__outer_1wax4","s":"calendar-range__s_1wax4","m":"calendar-range__m_1wax4","l":"calendar-range__l_1wax4","xl":"calendar-range__xl_1wax4"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
7
|
var Divider = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1e4hm */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-primary: #0e0e0e; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -41,29 +41,29 @@
|
|
|
41
41
|
/* disabled */
|
|
42
42
|
|
|
43
43
|
/* marker */
|
|
44
|
-
} .calendar-
|
|
44
|
+
} .calendar-range__component_1wax4 {
|
|
45
45
|
display: flex;
|
|
46
46
|
align-items: center;
|
|
47
47
|
justify-content: center;
|
|
48
48
|
width: 16px;
|
|
49
49
|
margin: 0 var(--gap-xs)
|
|
50
|
-
} .calendar-
|
|
50
|
+
} .calendar-range__component_1wax4:after {
|
|
51
51
|
content: '';
|
|
52
52
|
display: block;
|
|
53
53
|
width: 100%;
|
|
54
54
|
height: 1px;
|
|
55
55
|
background-color: var(--color-light-graphic-primary);
|
|
56
|
-
} .calendar-
|
|
56
|
+
} .calendar-range__outer_1wax4 {
|
|
57
57
|
position: relative;
|
|
58
58
|
|
|
59
59
|
/* FormControl .above height + margin-bottom */
|
|
60
60
|
top: 24px;
|
|
61
|
-
} .calendar-
|
|
61
|
+
} .calendar-range__s_1wax4 {
|
|
62
62
|
height: var(--size-s-height);
|
|
63
|
-
} .calendar-
|
|
63
|
+
} .calendar-range__m_1wax4 {
|
|
64
64
|
height: var(--size-m-height);
|
|
65
|
-
} .calendar-
|
|
65
|
+
} .calendar-range__l_1wax4 {
|
|
66
66
|
height: var(--size-l-height);
|
|
67
|
-
} .calendar-
|
|
67
|
+
} .calendar-range__xl_1wax4 {
|
|
68
68
|
height: var(--size-xl-height);
|
|
69
69
|
}
|
package/esm/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import 'classnames';
|
|
|
6
6
|
import 'date-fns/startOfMonth';
|
|
7
7
|
import '@alfalab/core-components-calendar-input/esm';
|
|
8
8
|
import '@alfalab/core-components-date-input/esm';
|
|
9
|
+
import '@alfalab/hooks';
|
|
9
10
|
import './components/divider/Component.js';
|
|
10
11
|
import './hooks.js';
|
|
11
12
|
import 'date-fns/addMonths';
|
|
@@ -13,7 +14,7 @@ import 'date-fns/isEqual';
|
|
|
13
14
|
import 'date-fns/max';
|
|
14
15
|
import 'date-fns/min';
|
|
15
16
|
import 'date-fns/subMonths';
|
|
16
|
-
import './index.module-
|
|
17
|
+
import './index.module-0d4b1792.js';
|
|
17
18
|
import './views/static.js';
|
|
18
19
|
import 'date-fns/endOfMonth';
|
|
19
20
|
import 'date-fns/isSameMonth';
|
package/esm/views/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: vvuga */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
/* disabled */
|
|
37
37
|
|
|
38
38
|
/* marker */
|
|
39
|
-
} .calendar-
|
|
39
|
+
} .calendar-range__component_zw4kk {
|
|
40
40
|
display: flex
|
|
41
|
-
} .calendar-
|
|
41
|
+
} .calendar-range__component_zw4kk button[aria-selected='true'] {
|
|
42
42
|
cursor: pointer;
|
|
43
|
-
} .calendar-
|
|
43
|
+
} .calendar-range__component_zw4kk *[class*='errorIcon_'] {
|
|
44
44
|
display: none;
|
|
45
|
-
} .calendar-
|
|
45
|
+
} .calendar-range__component_zw4kk *[class*='calendarIcon_'] {
|
|
46
46
|
margin-right: 0;
|
|
47
|
-
} .calendar-
|
|
47
|
+
} .calendar-range__static_zw4kk .calendar-range__calendar_zw4kk {
|
|
48
48
|
width: var(--calendar-inner-width);
|
|
49
49
|
}
|
package/esm/views/popover.js
CHANGED
|
@@ -4,9 +4,10 @@ import cn from 'classnames';
|
|
|
4
4
|
import startOfMonth from 'date-fns/startOfMonth';
|
|
5
5
|
import { isValidInputValue, parseDateString, CalendarInput } from '@alfalab/core-components-calendar-input/esm';
|
|
6
6
|
import { isCompleteDateInput } from '@alfalab/core-components-date-input/esm';
|
|
7
|
+
import { useDidUpdateEffect } from '@alfalab/hooks';
|
|
7
8
|
import { Divider } from '../components/divider/Component.js';
|
|
8
9
|
import { usePopoverViewMonthes } from '../hooks.js';
|
|
9
|
-
import { s as styles } from '../index.module-
|
|
10
|
+
import { s as styles } from '../index.module-0d4b1792.js';
|
|
10
11
|
import 'date-fns/addMonths';
|
|
11
12
|
import 'date-fns/isEqual';
|
|
12
13
|
import 'date-fns/max';
|
|
@@ -48,12 +49,16 @@ var CalendarRangePopover = function (_a) {
|
|
|
48
49
|
setInputToInvalid(inputToValue !== '' &&
|
|
49
50
|
!isValidInputValue(inputToValue, dateFrom || minDate, maxDate, offDays));
|
|
50
51
|
}, [dateFrom, inputToValue, maxDate, minDate, offDays]);
|
|
51
|
-
var handleInputFromChange =
|
|
52
|
+
var handleInputFromChange = function (event, payload) {
|
|
53
|
+
var _a;
|
|
52
54
|
setInputFromValue(payload.value);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
(_a = inputFromProps.onInputChange) === null || _a === void 0 ? void 0 : _a.call(inputFromProps, event, payload);
|
|
56
|
+
};
|
|
57
|
+
var handleInputToChange = function (event, payload) {
|
|
58
|
+
var _a;
|
|
55
59
|
setInputToValue(payload.value);
|
|
56
|
-
|
|
60
|
+
(_a = inputToProps.onInputChange) === null || _a === void 0 ? void 0 : _a.call(inputToProps, event, payload);
|
|
61
|
+
};
|
|
57
62
|
var handleInputFromBlur = useCallback(function () {
|
|
58
63
|
handleValidInputFrom();
|
|
59
64
|
setResetKey(+new Date());
|
|
@@ -74,7 +79,7 @@ var CalendarRangePopover = function (_a) {
|
|
|
74
79
|
useEffect(function () {
|
|
75
80
|
setInputToValue(valueTo);
|
|
76
81
|
}, [valueTo]);
|
|
77
|
-
|
|
82
|
+
useDidUpdateEffect(function () {
|
|
78
83
|
onDateFromChange({ value: inputFromValue, date: dateFrom });
|
|
79
84
|
onChange({
|
|
80
85
|
valueFrom: inputFromValue,
|
|
@@ -87,7 +92,7 @@ var CalendarRangePopover = function (_a) {
|
|
|
87
92
|
}
|
|
88
93
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
89
94
|
}, [inputFromValue]);
|
|
90
|
-
|
|
95
|
+
useDidUpdateEffect(function () {
|
|
91
96
|
onDateToChange({ value: inputToValue, date: dateTo });
|
|
92
97
|
onChange({
|
|
93
98
|
valueFrom: inputFromValue,
|
package/esm/views/static.js
CHANGED
|
@@ -13,7 +13,7 @@ import { isCompleteDateInput, DateInput } from '@alfalab/core-components-date-in
|
|
|
13
13
|
import { Divider } from '../components/divider/Component.js';
|
|
14
14
|
import { useStaticViewMonthes, useSelectionProps } from '../hooks.js';
|
|
15
15
|
import { isDayButton } from '../utils.js';
|
|
16
|
-
import { s as styles } from '../index.module-
|
|
16
|
+
import { s as styles } from '../index.module-0d4b1792.js';
|
|
17
17
|
import 'date-fns/isEqual';
|
|
18
18
|
import 'date-fns/min';
|
|
19
19
|
|
|
@@ -43,6 +43,8 @@ var CalendarRangeStatic = function (_a) {
|
|
|
43
43
|
var _p = useState(isCompleteDateInput(inputFromValue) && dateFrom === null), inputFromInvalid = _p[0], setInputFromInvalid = _p[1];
|
|
44
44
|
var _q = useState(isCompleteDateInput(inputToValue) && dateTo === null), inputToInvalid = _q[0], setInputToInvalid = _q[1];
|
|
45
45
|
var hasValidateError = bothInvalid || inputFromInvalid || inputToInvalid;
|
|
46
|
+
var calendarFromProps = inputFromProps.calendarProps, onInputChangeFrom = inputFromProps.onInputChange, dateInputFromProps = __rest(inputFromProps, ["calendarProps", "onInputChange"]);
|
|
47
|
+
var calendarToProps = inputToProps.calendarProps, onInputChangeTo = inputToProps.onInputChange, dateInputToProps = __rest(inputToProps, ["calendarProps", "onInputChange"]);
|
|
46
48
|
var _r = useStaticViewMonthes({
|
|
47
49
|
selectedFrom: period.selectedFrom,
|
|
48
50
|
selectedTo: period.selectedTo,
|
|
@@ -55,12 +57,14 @@ var CalendarRangeStatic = function (_a) {
|
|
|
55
57
|
var handleValidInputTo = useCallback(function () {
|
|
56
58
|
setInputToInvalid(inputToValue !== '' && !validateInputToValue(inputToValue));
|
|
57
59
|
}, [inputToValue, validateInputToValue]);
|
|
58
|
-
var handleInputFromChange =
|
|
60
|
+
var handleInputFromChange = function (event, payload) {
|
|
59
61
|
setInputFromValue(payload.value);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
onInputChangeFrom === null || onInputChangeFrom === void 0 ? void 0 : onInputChangeFrom(event, payload);
|
|
63
|
+
};
|
|
64
|
+
var handleInputToChange = function (event, payload) {
|
|
62
65
|
setInputToValue(payload.value);
|
|
63
|
-
|
|
66
|
+
onInputChangeTo === null || onInputChangeTo === void 0 ? void 0 : onInputChangeTo(event, payload);
|
|
67
|
+
};
|
|
64
68
|
var handleMouseOver = useCallback(function (event) {
|
|
65
69
|
var target = event.target;
|
|
66
70
|
var mouseOverDayButton = isDayButton(target) || isDayButton(target.parentElement);
|
|
@@ -142,8 +146,6 @@ var CalendarRangeStatic = function (_a) {
|
|
|
142
146
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
143
147
|
}, [hasValidateError]);
|
|
144
148
|
var rangeProps = useSelectionProps(period.selectedFrom, period.selectedTo, highlightedDate);
|
|
145
|
-
var calendarFromProps = inputFromProps.calendarProps, dateInputFromProps = __rest(inputFromProps, ["calendarProps"]);
|
|
146
|
-
var calendarToProps = inputToProps.calendarProps, dateInputToProps = __rest(inputToProps, ["calendarProps"]);
|
|
147
149
|
var CalendarFromComponent = dateInputFromProps.Calendar || Calendar;
|
|
148
150
|
var CalendarToComponent = dateInputToProps.Calendar || Calendar;
|
|
149
151
|
var minMaxInSameMonth = minDate && maxDate && isSameMonth(minDate, maxDate);
|
package/index.js
CHANGED
|
@@ -10,6 +10,7 @@ require('classnames');
|
|
|
10
10
|
require('date-fns/startOfMonth');
|
|
11
11
|
require('@alfalab/core-components-calendar-input');
|
|
12
12
|
require('@alfalab/core-components-date-input');
|
|
13
|
+
require('@alfalab/hooks');
|
|
13
14
|
require('./components/divider/Component.js');
|
|
14
15
|
require('./hooks.js');
|
|
15
16
|
require('date-fns/addMonths');
|
|
@@ -17,7 +18,7 @@ require('date-fns/isEqual');
|
|
|
17
18
|
require('date-fns/max');
|
|
18
19
|
require('date-fns/min');
|
|
19
20
|
require('date-fns/subMonths');
|
|
20
|
-
require('./index.module-
|
|
21
|
+
require('./index.module-1acef89e.js');
|
|
21
22
|
require('./views/static.js');
|
|
22
23
|
require('date-fns/endOfMonth');
|
|
23
24
|
require('date-fns/isSameMonth');
|
package/modern/Component.js
CHANGED
|
@@ -5,6 +5,7 @@ import 'classnames';
|
|
|
5
5
|
import 'date-fns/startOfMonth';
|
|
6
6
|
import '@alfalab/core-components-calendar-input/modern';
|
|
7
7
|
import '@alfalab/core-components-date-input/modern';
|
|
8
|
+
import '@alfalab/hooks';
|
|
8
9
|
import './components/divider/Component.js';
|
|
9
10
|
import './hooks.js';
|
|
10
11
|
import 'date-fns/addMonths';
|
|
@@ -12,7 +13,7 @@ import 'date-fns/isEqual';
|
|
|
12
13
|
import 'date-fns/max';
|
|
13
14
|
import 'date-fns/min';
|
|
14
15
|
import 'date-fns/subMonths';
|
|
15
|
-
import './index.module-
|
|
16
|
+
import './index.module-43648a9b.js';
|
|
16
17
|
import 'date-fns/endOfMonth';
|
|
17
18
|
import 'date-fns/isSameMonth';
|
|
18
19
|
import '@alfalab/core-components-calendar/modern';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
const styles = {"component":"calendar-
|
|
4
|
+
const styles = {"component":"calendar-range__component_1wax4","outer":"calendar-range__outer_1wax4","s":"calendar-range__s_1wax4","m":"calendar-range__m_1wax4","l":"calendar-range__l_1wax4","xl":"calendar-range__xl_1wax4"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
7
|
const Divider = ({ inputFromProps, inputToProps }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1e4hm */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-primary: #0e0e0e; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -41,29 +41,29 @@
|
|
|
41
41
|
/* disabled */
|
|
42
42
|
|
|
43
43
|
/* marker */
|
|
44
|
-
} .calendar-
|
|
44
|
+
} .calendar-range__component_1wax4 {
|
|
45
45
|
display: flex;
|
|
46
46
|
align-items: center;
|
|
47
47
|
justify-content: center;
|
|
48
48
|
width: 16px;
|
|
49
49
|
margin: 0 var(--gap-xs)
|
|
50
|
-
} .calendar-
|
|
50
|
+
} .calendar-range__component_1wax4:after {
|
|
51
51
|
content: '';
|
|
52
52
|
display: block;
|
|
53
53
|
width: 100%;
|
|
54
54
|
height: 1px;
|
|
55
55
|
background-color: var(--color-light-graphic-primary);
|
|
56
|
-
} .calendar-
|
|
56
|
+
} .calendar-range__outer_1wax4 {
|
|
57
57
|
position: relative;
|
|
58
58
|
|
|
59
59
|
/* FormControl .above height + margin-bottom */
|
|
60
60
|
top: 24px;
|
|
61
|
-
} .calendar-
|
|
61
|
+
} .calendar-range__s_1wax4 {
|
|
62
62
|
height: var(--size-s-height);
|
|
63
|
-
} .calendar-
|
|
63
|
+
} .calendar-range__m_1wax4 {
|
|
64
64
|
height: var(--size-m-height);
|
|
65
|
-
} .calendar-
|
|
65
|
+
} .calendar-range__l_1wax4 {
|
|
66
66
|
height: var(--size-l-height);
|
|
67
|
-
} .calendar-
|
|
67
|
+
} .calendar-range__xl_1wax4 {
|
|
68
68
|
height: var(--size-xl-height);
|
|
69
69
|
}
|
package/modern/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import 'classnames';
|
|
|
5
5
|
import 'date-fns/startOfMonth';
|
|
6
6
|
import '@alfalab/core-components-calendar-input/modern';
|
|
7
7
|
import '@alfalab/core-components-date-input/modern';
|
|
8
|
+
import '@alfalab/hooks';
|
|
8
9
|
import './components/divider/Component.js';
|
|
9
10
|
import './hooks.js';
|
|
10
11
|
import 'date-fns/addMonths';
|
|
@@ -12,7 +13,7 @@ import 'date-fns/isEqual';
|
|
|
12
13
|
import 'date-fns/max';
|
|
13
14
|
import 'date-fns/min';
|
|
14
15
|
import 'date-fns/subMonths';
|
|
15
|
-
import './index.module-
|
|
16
|
+
import './index.module-43648a9b.js';
|
|
16
17
|
import './views/static.js';
|
|
17
18
|
import 'date-fns/endOfMonth';
|
|
18
19
|
import 'date-fns/isSameMonth';
|
package/modern/views/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: vvuga */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
/* disabled */
|
|
37
37
|
|
|
38
38
|
/* marker */
|
|
39
|
-
} .calendar-
|
|
39
|
+
} .calendar-range__component_zw4kk {
|
|
40
40
|
display: flex
|
|
41
|
-
} .calendar-
|
|
41
|
+
} .calendar-range__component_zw4kk button[aria-selected='true'] {
|
|
42
42
|
cursor: pointer;
|
|
43
|
-
} .calendar-
|
|
43
|
+
} .calendar-range__component_zw4kk *[class*='errorIcon_'] {
|
|
44
44
|
display: none;
|
|
45
|
-
} .calendar-
|
|
45
|
+
} .calendar-range__component_zw4kk *[class*='calendarIcon_'] {
|
|
46
46
|
margin-right: 0;
|
|
47
|
-
} .calendar-
|
|
47
|
+
} .calendar-range__static_zw4kk .calendar-range__calendar_zw4kk {
|
|
48
48
|
width: var(--calendar-inner-width);
|
|
49
49
|
}
|
package/modern/views/popover.js
CHANGED
|
@@ -3,9 +3,10 @@ import cn from 'classnames';
|
|
|
3
3
|
import startOfMonth from 'date-fns/startOfMonth';
|
|
4
4
|
import { isValidInputValue, parseDateString, CalendarInput } from '@alfalab/core-components-calendar-input/modern';
|
|
5
5
|
import { isCompleteDateInput } from '@alfalab/core-components-date-input/modern';
|
|
6
|
+
import { useDidUpdateEffect } from '@alfalab/hooks';
|
|
6
7
|
import { Divider } from '../components/divider/Component.js';
|
|
7
8
|
import { usePopoverViewMonthes } from '../hooks.js';
|
|
8
|
-
import { s as styles } from '../index.module-
|
|
9
|
+
import { s as styles } from '../index.module-43648a9b.js';
|
|
9
10
|
import 'date-fns/addMonths';
|
|
10
11
|
import 'date-fns/isEqual';
|
|
11
12
|
import 'date-fns/max';
|
|
@@ -46,12 +47,14 @@ const CalendarRangePopover = ({ className, defaultMonth = startOfMonth(new Date(
|
|
|
46
47
|
setInputToInvalid(inputToValue !== '' &&
|
|
47
48
|
!isValidInputValue(inputToValue, dateFrom || minDate, maxDate, offDays));
|
|
48
49
|
}, [dateFrom, inputToValue, maxDate, minDate, offDays]);
|
|
49
|
-
const handleInputFromChange =
|
|
50
|
+
const handleInputFromChange = (event, payload) => {
|
|
50
51
|
setInputFromValue(payload.value);
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
inputFromProps.onInputChange?.(event, payload);
|
|
53
|
+
};
|
|
54
|
+
const handleInputToChange = (event, payload) => {
|
|
53
55
|
setInputToValue(payload.value);
|
|
54
|
-
|
|
56
|
+
inputToProps.onInputChange?.(event, payload);
|
|
57
|
+
};
|
|
55
58
|
const handleInputFromBlur = useCallback(() => {
|
|
56
59
|
handleValidInputFrom();
|
|
57
60
|
setResetKey(+new Date());
|
|
@@ -72,7 +75,7 @@ const CalendarRangePopover = ({ className, defaultMonth = startOfMonth(new Date(
|
|
|
72
75
|
useEffect(() => {
|
|
73
76
|
setInputToValue(valueTo);
|
|
74
77
|
}, [valueTo]);
|
|
75
|
-
|
|
78
|
+
useDidUpdateEffect(() => {
|
|
76
79
|
onDateFromChange({ value: inputFromValue, date: dateFrom });
|
|
77
80
|
onChange({
|
|
78
81
|
valueFrom: inputFromValue,
|
|
@@ -85,7 +88,7 @@ const CalendarRangePopover = ({ className, defaultMonth = startOfMonth(new Date(
|
|
|
85
88
|
}
|
|
86
89
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
90
|
}, [inputFromValue]);
|
|
88
|
-
|
|
91
|
+
useDidUpdateEffect(() => {
|
|
89
92
|
onDateToChange({ value: inputToValue, date: dateTo });
|
|
90
93
|
onChange({
|
|
91
94
|
valueFrom: inputFromValue,
|
package/modern/views/static.js
CHANGED
|
@@ -12,7 +12,7 @@ import { isCompleteDateInput, DateInput } from '@alfalab/core-components-date-in
|
|
|
12
12
|
import { Divider } from '../components/divider/Component.js';
|
|
13
13
|
import { useStaticViewMonthes, useSelectionProps } from '../hooks.js';
|
|
14
14
|
import { isDayButton } from '../utils.js';
|
|
15
|
-
import { s as styles } from '../index.module-
|
|
15
|
+
import { s as styles } from '../index.module-43648a9b.js';
|
|
16
16
|
import 'date-fns/isEqual';
|
|
17
17
|
import 'date-fns/min';
|
|
18
18
|
|
|
@@ -42,6 +42,8 @@ const CalendarRangeStatic = ({ className, defaultMonth = startOfMonth(new Date()
|
|
|
42
42
|
const [inputFromInvalid, setInputFromInvalid] = useState(isCompleteDateInput(inputFromValue) && dateFrom === null);
|
|
43
43
|
const [inputToInvalid, setInputToInvalid] = useState(isCompleteDateInput(inputToValue) && dateTo === null);
|
|
44
44
|
const hasValidateError = bothInvalid || inputFromInvalid || inputToInvalid;
|
|
45
|
+
const { calendarProps: calendarFromProps, onInputChange: onInputChangeFrom, ...dateInputFromProps } = inputFromProps;
|
|
46
|
+
const { calendarProps: calendarToProps, onInputChange: onInputChangeTo, ...dateInputToProps } = inputToProps;
|
|
45
47
|
const { monthFrom, monthTo, handleMonthFromChange, handleMonthToChange } = useStaticViewMonthes({
|
|
46
48
|
selectedFrom: period.selectedFrom,
|
|
47
49
|
selectedTo: period.selectedTo,
|
|
@@ -54,12 +56,14 @@ const CalendarRangeStatic = ({ className, defaultMonth = startOfMonth(new Date()
|
|
|
54
56
|
const handleValidInputTo = useCallback(() => {
|
|
55
57
|
setInputToInvalid(inputToValue !== '' && !validateInputToValue(inputToValue));
|
|
56
58
|
}, [inputToValue, validateInputToValue]);
|
|
57
|
-
const handleInputFromChange =
|
|
59
|
+
const handleInputFromChange = (event, payload) => {
|
|
58
60
|
setInputFromValue(payload.value);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
onInputChangeFrom?.(event, payload);
|
|
62
|
+
};
|
|
63
|
+
const handleInputToChange = (event, payload) => {
|
|
61
64
|
setInputToValue(payload.value);
|
|
62
|
-
|
|
65
|
+
onInputChangeTo?.(event, payload);
|
|
66
|
+
};
|
|
63
67
|
const handleMouseOver = useCallback((event) => {
|
|
64
68
|
const target = event.target;
|
|
65
69
|
const mouseOverDayButton = isDayButton(target) || isDayButton(target.parentElement);
|
|
@@ -141,8 +145,6 @@ const CalendarRangeStatic = ({ className, defaultMonth = startOfMonth(new Date()
|
|
|
141
145
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
142
146
|
}, [hasValidateError]);
|
|
143
147
|
const rangeProps = useSelectionProps(period.selectedFrom, period.selectedTo, highlightedDate);
|
|
144
|
-
const { calendarProps: calendarFromProps, ...dateInputFromProps } = inputFromProps;
|
|
145
|
-
const { calendarProps: calendarToProps, ...dateInputToProps } = inputToProps;
|
|
146
148
|
const CalendarFromComponent = dateInputFromProps.Calendar || Calendar;
|
|
147
149
|
const CalendarToComponent = dateInputToProps.Calendar || Calendar;
|
|
148
150
|
const minMaxInSameMonth = minDate && maxDate && isSameMonth(minDate, maxDate);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-calendar-range",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.30",
|
|
4
4
|
"description": "Calendar range component",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
"react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@alfalab/core-components-calendar": "^6.3.
|
|
22
|
-
"@alfalab/core-components-calendar-input": "^8.2.
|
|
23
|
-
"@alfalab/core-components-date-input": "^4.2.
|
|
21
|
+
"@alfalab/core-components-calendar": "^6.3.2",
|
|
22
|
+
"@alfalab/core-components-calendar-input": "^8.2.23",
|
|
23
|
+
"@alfalab/core-components-date-input": "^4.2.5",
|
|
24
|
+
"@alfalab/hooks": "^1.13.0",
|
|
24
25
|
"classnames": "^2.3.1",
|
|
25
26
|
"date-fns": "^2.16.1",
|
|
26
27
|
"tslib": "^2.4.0"
|
package/views/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: vvuga */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
4
|
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
/* disabled */
|
|
37
37
|
|
|
38
38
|
/* marker */
|
|
39
|
-
} .calendar-
|
|
39
|
+
} .calendar-range__component_zw4kk {
|
|
40
40
|
display: flex
|
|
41
|
-
} .calendar-
|
|
41
|
+
} .calendar-range__component_zw4kk button[aria-selected='true'] {
|
|
42
42
|
cursor: pointer;
|
|
43
|
-
} .calendar-
|
|
43
|
+
} .calendar-range__component_zw4kk *[class*='errorIcon_'] {
|
|
44
44
|
display: none;
|
|
45
|
-
} .calendar-
|
|
45
|
+
} .calendar-range__component_zw4kk *[class*='calendarIcon_'] {
|
|
46
46
|
margin-right: 0;
|
|
47
|
-
} .calendar-
|
|
47
|
+
} .calendar-range__static_zw4kk .calendar-range__calendar_zw4kk {
|
|
48
48
|
width: var(--calendar-inner-width);
|
|
49
49
|
}
|
package/views/popover.js
CHANGED
|
@@ -8,9 +8,10 @@ var cn = require('classnames');
|
|
|
8
8
|
var startOfMonth = require('date-fns/startOfMonth');
|
|
9
9
|
var coreComponentsCalendarInput = require('@alfalab/core-components-calendar-input');
|
|
10
10
|
var coreComponentsDateInput = require('@alfalab/core-components-date-input');
|
|
11
|
+
var hooks$1 = require('@alfalab/hooks');
|
|
11
12
|
var components_divider_Component = require('../components/divider/Component.js');
|
|
12
13
|
var hooks = require('../hooks.js');
|
|
13
|
-
var index_module = require('../index.module-
|
|
14
|
+
var index_module = require('../index.module-1acef89e.js');
|
|
14
15
|
require('date-fns/addMonths');
|
|
15
16
|
require('date-fns/isEqual');
|
|
16
17
|
require('date-fns/max');
|
|
@@ -58,12 +59,16 @@ var CalendarRangePopover = function (_a) {
|
|
|
58
59
|
setInputToInvalid(inputToValue !== '' &&
|
|
59
60
|
!coreComponentsCalendarInput.isValidInputValue(inputToValue, dateFrom || minDate, maxDate, offDays));
|
|
60
61
|
}, [dateFrom, inputToValue, maxDate, minDate, offDays]);
|
|
61
|
-
var handleInputFromChange =
|
|
62
|
+
var handleInputFromChange = function (event, payload) {
|
|
63
|
+
var _a;
|
|
62
64
|
setInputFromValue(payload.value);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
(_a = inputFromProps.onInputChange) === null || _a === void 0 ? void 0 : _a.call(inputFromProps, event, payload);
|
|
66
|
+
};
|
|
67
|
+
var handleInputToChange = function (event, payload) {
|
|
68
|
+
var _a;
|
|
65
69
|
setInputToValue(payload.value);
|
|
66
|
-
|
|
70
|
+
(_a = inputToProps.onInputChange) === null || _a === void 0 ? void 0 : _a.call(inputToProps, event, payload);
|
|
71
|
+
};
|
|
67
72
|
var handleInputFromBlur = React.useCallback(function () {
|
|
68
73
|
handleValidInputFrom();
|
|
69
74
|
setResetKey(+new Date());
|
|
@@ -84,7 +89,7 @@ var CalendarRangePopover = function (_a) {
|
|
|
84
89
|
React.useEffect(function () {
|
|
85
90
|
setInputToValue(valueTo);
|
|
86
91
|
}, [valueTo]);
|
|
87
|
-
|
|
92
|
+
hooks$1.useDidUpdateEffect(function () {
|
|
88
93
|
onDateFromChange({ value: inputFromValue, date: dateFrom });
|
|
89
94
|
onChange({
|
|
90
95
|
valueFrom: inputFromValue,
|
|
@@ -97,7 +102,7 @@ var CalendarRangePopover = function (_a) {
|
|
|
97
102
|
}
|
|
98
103
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
99
104
|
}, [inputFromValue]);
|
|
100
|
-
|
|
105
|
+
hooks$1.useDidUpdateEffect(function () {
|
|
101
106
|
onDateToChange({ value: inputToValue, date: dateTo });
|
|
102
107
|
onChange({
|
|
103
108
|
valueFrom: inputFromValue,
|
package/views/static.js
CHANGED
|
@@ -17,7 +17,7 @@ var coreComponentsDateInput = require('@alfalab/core-components-date-input');
|
|
|
17
17
|
var components_divider_Component = require('../components/divider/Component.js');
|
|
18
18
|
var hooks = require('../hooks.js');
|
|
19
19
|
var utils = require('../utils.js');
|
|
20
|
-
var index_module = require('../index.module-
|
|
20
|
+
var index_module = require('../index.module-1acef89e.js');
|
|
21
21
|
require('date-fns/isEqual');
|
|
22
22
|
require('date-fns/min');
|
|
23
23
|
|
|
@@ -58,6 +58,8 @@ var CalendarRangeStatic = function (_a) {
|
|
|
58
58
|
var _p = React.useState(coreComponentsDateInput.isCompleteDateInput(inputFromValue) && dateFrom === null), inputFromInvalid = _p[0], setInputFromInvalid = _p[1];
|
|
59
59
|
var _q = React.useState(coreComponentsDateInput.isCompleteDateInput(inputToValue) && dateTo === null), inputToInvalid = _q[0], setInputToInvalid = _q[1];
|
|
60
60
|
var hasValidateError = bothInvalid || inputFromInvalid || inputToInvalid;
|
|
61
|
+
var calendarFromProps = inputFromProps.calendarProps, onInputChangeFrom = inputFromProps.onInputChange, dateInputFromProps = tslib.__rest(inputFromProps, ["calendarProps", "onInputChange"]);
|
|
62
|
+
var calendarToProps = inputToProps.calendarProps, onInputChangeTo = inputToProps.onInputChange, dateInputToProps = tslib.__rest(inputToProps, ["calendarProps", "onInputChange"]);
|
|
61
63
|
var _r = hooks.useStaticViewMonthes({
|
|
62
64
|
selectedFrom: period.selectedFrom,
|
|
63
65
|
selectedTo: period.selectedTo,
|
|
@@ -70,12 +72,14 @@ var CalendarRangeStatic = function (_a) {
|
|
|
70
72
|
var handleValidInputTo = React.useCallback(function () {
|
|
71
73
|
setInputToInvalid(inputToValue !== '' && !validateInputToValue(inputToValue));
|
|
72
74
|
}, [inputToValue, validateInputToValue]);
|
|
73
|
-
var handleInputFromChange =
|
|
75
|
+
var handleInputFromChange = function (event, payload) {
|
|
74
76
|
setInputFromValue(payload.value);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
onInputChangeFrom === null || onInputChangeFrom === void 0 ? void 0 : onInputChangeFrom(event, payload);
|
|
78
|
+
};
|
|
79
|
+
var handleInputToChange = function (event, payload) {
|
|
77
80
|
setInputToValue(payload.value);
|
|
78
|
-
|
|
81
|
+
onInputChangeTo === null || onInputChangeTo === void 0 ? void 0 : onInputChangeTo(event, payload);
|
|
82
|
+
};
|
|
79
83
|
var handleMouseOver = React.useCallback(function (event) {
|
|
80
84
|
var target = event.target;
|
|
81
85
|
var mouseOverDayButton = utils.isDayButton(target) || utils.isDayButton(target.parentElement);
|
|
@@ -157,8 +161,6 @@ var CalendarRangeStatic = function (_a) {
|
|
|
157
161
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
158
162
|
}, [hasValidateError]);
|
|
159
163
|
var rangeProps = hooks.useSelectionProps(period.selectedFrom, period.selectedTo, highlightedDate);
|
|
160
|
-
var calendarFromProps = inputFromProps.calendarProps, dateInputFromProps = tslib.__rest(inputFromProps, ["calendarProps"]);
|
|
161
|
-
var calendarToProps = inputToProps.calendarProps, dateInputToProps = tslib.__rest(inputToProps, ["calendarProps"]);
|
|
162
164
|
var CalendarFromComponent = dateInputFromProps.Calendar || coreComponentsCalendar.Calendar;
|
|
163
165
|
var CalendarToComponent = dateInputToProps.Calendar || coreComponentsCalendar.Calendar;
|
|
164
166
|
var minMaxInSameMonth = minDate && maxDate && isSameMonth__default.default(minDate, maxDate);
|
package/index.module-3b916d55.js
DELETED