@alfalab/core-components-calendar-range 3.2.2 → 4.0.3
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/CHANGELOG.md +43 -0
- package/dist/Component.js +1 -1
- package/dist/cssm/useCalendarMonthes.js +12 -4
- package/dist/esm/Component.js +1 -1
- package/dist/esm/index.css +5 -5
- package/dist/esm/useCalendarMonthes.js +12 -4
- package/dist/index.css +5 -5
- package/dist/modern/Component.js +1 -1
- package/dist/modern/index.css +5 -5
- package/dist/modern/useCalendarMonthes.js +12 -4
- package/dist/useCalendarMonthes.js +12 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.3](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-range@4.0.2...@alfalab/core-components-calendar-range@4.0.3) (2021-11-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alfalab/core-components-calendar-range
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [4.0.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-range@4.0.1...@alfalab/core-components-calendar-range@4.0.2) (2021-11-22)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **calendar-range:** fix default month to ([#868](https://github.com/alfa-laboratory/core-components/issues/868)) ([1f9fb97](https://github.com/alfa-laboratory/core-components/commit/1f9fb9709292d28300c3fc4386ffd858b2efd852))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [4.0.1](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-range@4.0.0...@alfalab/core-components-calendar-range@4.0.1) (2021-11-16)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @alfalab/core-components-calendar-range
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [4.0.0](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-range@3.2.2...@alfalab/core-components-calendar-range@4.0.0) (2021-10-15)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* **calendar-input:** переход к темизации цвета иконки ([adf1dfd](https://github.com/alfa-laboratory/core-components/commit/adf1dfd080c1986976a57fee448183e762892eb0))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### BREAKING CHANGES
|
|
42
|
+
|
|
43
|
+
* **calendar-input:** удалена переменная --calendar-input-calendar-icon
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
## [3.2.2](https://github.com/alfa-laboratory/core-components/compare/@alfalab/core-components-calendar-range@3.2.1...@alfalab/core-components-calendar-range@3.2.2) (2021-10-15)
|
|
7
50
|
|
|
8
51
|
**Note:** Version bump only for package @alfalab/core-components-calendar-range
|
package/dist/Component.js
CHANGED
|
@@ -43,7 +43,7 @@ var __assign = function () {
|
|
|
43
43
|
return __assign.apply(this, arguments);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
var styles = {"component":"calendar-
|
|
46
|
+
var styles = {"component":"calendar-range__component_1lgx3","divider":"calendar-range__divider_1lgx3"};
|
|
47
47
|
require('./index.css')
|
|
48
48
|
|
|
49
49
|
var CalendarRange = function (_a) {
|
|
@@ -7,10 +7,18 @@ var dateFns = require('date-fns');
|
|
|
7
7
|
|
|
8
8
|
function useCalendarMonthes(_a) {
|
|
9
9
|
var inputValueFrom = _a.inputValueFrom, inputValueTo = _a.inputValueTo, defaultMonth = _a.defaultMonth, isPopover = _a.isPopover;
|
|
10
|
-
var initialMonthFrom =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
var initialMonthFrom = (function () {
|
|
11
|
+
if (inputValueFrom.value && inputValueFrom.date) {
|
|
12
|
+
return dateFns.startOfMonth(inputValueFrom.date).getTime();
|
|
13
|
+
}
|
|
14
|
+
return defaultMonth;
|
|
15
|
+
})();
|
|
16
|
+
var initialMonthTo = (function () {
|
|
17
|
+
if (inputValueTo.value && inputValueTo.date) {
|
|
18
|
+
return dateFns.startOfMonth(inputValueTo.date).getTime();
|
|
19
|
+
}
|
|
20
|
+
return isPopover ? initialMonthFrom : dateFns.addMonths(initialMonthFrom, 1).getTime();
|
|
21
|
+
})();
|
|
14
22
|
var _b = React.useState(initialMonthFrom), monthFrom = _b[0], setMonthFrom = _b[1];
|
|
15
23
|
var _c = React.useState(initialMonthTo), monthTo = _c[0], setMonthTo = _c[1];
|
|
16
24
|
var handleMonthFromChange = React.useCallback(function (newMonthFrom) {
|
package/dist/esm/Component.js
CHANGED
|
@@ -34,7 +34,7 @@ var __assign = function () {
|
|
|
34
34
|
return __assign.apply(this, arguments);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
var styles = {"component":"calendar-
|
|
37
|
+
var styles = {"component":"calendar-range__component_1lgx3","divider":"calendar-range__divider_1lgx3"};
|
|
38
38
|
require('./index.css')
|
|
39
39
|
|
|
40
40
|
var CalendarRange = function (_a) {
|
package/dist/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1byhf */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-primary: #0b1f35;
|
|
4
4
|
}
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
:root {
|
|
14
14
|
--gap-xs: 8px;
|
|
15
15
|
}
|
|
16
|
-
.calendar-
|
|
16
|
+
.calendar-range__component_1lgx3 {
|
|
17
17
|
display: flex
|
|
18
18
|
}
|
|
19
|
-
.calendar-
|
|
19
|
+
.calendar-range__component_1lgx3 button[aria-selected='true'] {
|
|
20
20
|
cursor: pointer;
|
|
21
21
|
}
|
|
22
|
-
.calendar-
|
|
22
|
+
.calendar-range__divider_1lgx3 {
|
|
23
23
|
height: 48px;
|
|
24
24
|
display: flex;
|
|
25
25
|
align-items: center;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
width: 16px;
|
|
28
28
|
margin: 0 var(--gap-xs)
|
|
29
29
|
}
|
|
30
|
-
.calendar-
|
|
30
|
+
.calendar-range__divider_1lgx3:after {
|
|
31
31
|
content: '';
|
|
32
32
|
display: block;
|
|
33
33
|
width: 100%;
|
|
@@ -3,10 +3,18 @@ import { startOfMonth, addMonths, subMonths } from 'date-fns';
|
|
|
3
3
|
|
|
4
4
|
function useCalendarMonthes(_a) {
|
|
5
5
|
var inputValueFrom = _a.inputValueFrom, inputValueTo = _a.inputValueTo, defaultMonth = _a.defaultMonth, isPopover = _a.isPopover;
|
|
6
|
-
var initialMonthFrom =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
var initialMonthFrom = (function () {
|
|
7
|
+
if (inputValueFrom.value && inputValueFrom.date) {
|
|
8
|
+
return startOfMonth(inputValueFrom.date).getTime();
|
|
9
|
+
}
|
|
10
|
+
return defaultMonth;
|
|
11
|
+
})();
|
|
12
|
+
var initialMonthTo = (function () {
|
|
13
|
+
if (inputValueTo.value && inputValueTo.date) {
|
|
14
|
+
return startOfMonth(inputValueTo.date).getTime();
|
|
15
|
+
}
|
|
16
|
+
return isPopover ? initialMonthFrom : addMonths(initialMonthFrom, 1).getTime();
|
|
17
|
+
})();
|
|
10
18
|
var _b = useState(initialMonthFrom), monthFrom = _b[0], setMonthFrom = _b[1];
|
|
11
19
|
var _c = useState(initialMonthTo), monthTo = _c[0], setMonthTo = _c[1];
|
|
12
20
|
var handleMonthFromChange = useCallback(function (newMonthFrom) {
|
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1byhf */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-primary: #0b1f35;
|
|
4
4
|
}
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
:root {
|
|
14
14
|
--gap-xs: 8px;
|
|
15
15
|
}
|
|
16
|
-
.calendar-
|
|
16
|
+
.calendar-range__component_1lgx3 {
|
|
17
17
|
display: flex
|
|
18
18
|
}
|
|
19
|
-
.calendar-
|
|
19
|
+
.calendar-range__component_1lgx3 button[aria-selected='true'] {
|
|
20
20
|
cursor: pointer;
|
|
21
21
|
}
|
|
22
|
-
.calendar-
|
|
22
|
+
.calendar-range__divider_1lgx3 {
|
|
23
23
|
height: 48px;
|
|
24
24
|
display: flex;
|
|
25
25
|
align-items: center;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
width: 16px;
|
|
28
28
|
margin: 0 var(--gap-xs)
|
|
29
29
|
}
|
|
30
|
-
.calendar-
|
|
30
|
+
.calendar-range__divider_1lgx3:after {
|
|
31
31
|
content: '';
|
|
32
32
|
display: block;
|
|
33
33
|
width: 100%;
|
package/dist/modern/Component.js
CHANGED
|
@@ -7,7 +7,7 @@ import { initialValueState, getCorrectValueState, isDayButton } from './utils.js
|
|
|
7
7
|
import { useCalendarMonthes } from './useCalendarMonthes.js';
|
|
8
8
|
import { useCalendarMaxMinDates } from './useCalendarMaxMinDates.js';
|
|
9
9
|
|
|
10
|
-
var styles = {"component":"calendar-
|
|
10
|
+
var styles = {"component":"calendar-range__component_1lgx3","divider":"calendar-range__divider_1lgx3"};
|
|
11
11
|
require('./index.css')
|
|
12
12
|
|
|
13
13
|
/* eslint-disable multiline-comment-style */
|
package/dist/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1byhf */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-primary: #0b1f35;
|
|
4
4
|
}
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
:root {
|
|
14
14
|
--gap-xs: 8px;
|
|
15
15
|
}
|
|
16
|
-
.calendar-
|
|
16
|
+
.calendar-range__component_1lgx3 {
|
|
17
17
|
display: flex
|
|
18
18
|
}
|
|
19
|
-
.calendar-
|
|
19
|
+
.calendar-range__component_1lgx3 button[aria-selected='true'] {
|
|
20
20
|
cursor: pointer;
|
|
21
21
|
}
|
|
22
|
-
.calendar-
|
|
22
|
+
.calendar-range__divider_1lgx3 {
|
|
23
23
|
height: 48px;
|
|
24
24
|
display: flex;
|
|
25
25
|
align-items: center;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
width: 16px;
|
|
28
28
|
margin: 0 var(--gap-xs)
|
|
29
29
|
}
|
|
30
|
-
.calendar-
|
|
30
|
+
.calendar-range__divider_1lgx3:after {
|
|
31
31
|
content: '';
|
|
32
32
|
display: block;
|
|
33
33
|
width: 100%;
|
|
@@ -2,10 +2,18 @@ import { useState, useCallback } from 'react';
|
|
|
2
2
|
import { startOfMonth, addMonths, subMonths } from 'date-fns';
|
|
3
3
|
|
|
4
4
|
function useCalendarMonthes({ inputValueFrom, inputValueTo, defaultMonth, isPopover, }) {
|
|
5
|
-
const initialMonthFrom =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const initialMonthFrom = (() => {
|
|
6
|
+
if (inputValueFrom.value && inputValueFrom.date) {
|
|
7
|
+
return startOfMonth(inputValueFrom.date).getTime();
|
|
8
|
+
}
|
|
9
|
+
return defaultMonth;
|
|
10
|
+
})();
|
|
11
|
+
const initialMonthTo = (() => {
|
|
12
|
+
if (inputValueTo.value && inputValueTo.date) {
|
|
13
|
+
return startOfMonth(inputValueTo.date).getTime();
|
|
14
|
+
}
|
|
15
|
+
return isPopover ? initialMonthFrom : addMonths(initialMonthFrom, 1).getTime();
|
|
16
|
+
})();
|
|
9
17
|
const [monthFrom, setMonthFrom] = useState(initialMonthFrom);
|
|
10
18
|
const [monthTo, setMonthTo] = useState(initialMonthTo);
|
|
11
19
|
const handleMonthFromChange = useCallback((newMonthFrom) => {
|
|
@@ -7,10 +7,18 @@ var dateFns = require('date-fns');
|
|
|
7
7
|
|
|
8
8
|
function useCalendarMonthes(_a) {
|
|
9
9
|
var inputValueFrom = _a.inputValueFrom, inputValueTo = _a.inputValueTo, defaultMonth = _a.defaultMonth, isPopover = _a.isPopover;
|
|
10
|
-
var initialMonthFrom =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
var initialMonthFrom = (function () {
|
|
11
|
+
if (inputValueFrom.value && inputValueFrom.date) {
|
|
12
|
+
return dateFns.startOfMonth(inputValueFrom.date).getTime();
|
|
13
|
+
}
|
|
14
|
+
return defaultMonth;
|
|
15
|
+
})();
|
|
16
|
+
var initialMonthTo = (function () {
|
|
17
|
+
if (inputValueTo.value && inputValueTo.date) {
|
|
18
|
+
return dateFns.startOfMonth(inputValueTo.date).getTime();
|
|
19
|
+
}
|
|
20
|
+
return isPopover ? initialMonthFrom : dateFns.addMonths(initialMonthFrom, 1).getTime();
|
|
21
|
+
})();
|
|
14
22
|
var _b = React.useState(initialMonthFrom), monthFrom = _b[0], setMonthFrom = _b[1];
|
|
15
23
|
var _c = React.useState(initialMonthTo), monthTo = _c[0], setMonthTo = _c[1];
|
|
16
24
|
var handleMonthFromChange = React.useCallback(function (newMonthFrom) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-calendar-range",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Calendar range component",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"react-dom": "^16.9.0 || ^17.0.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@alfalab/core-components-calendar": "^3.1.
|
|
23
|
-
"@alfalab/core-components-calendar-input": "^
|
|
22
|
+
"@alfalab/core-components-calendar": "^3.1.4",
|
|
23
|
+
"@alfalab/core-components-calendar-input": "^5.0.2",
|
|
24
24
|
"classnames": "^2.2.6",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"react-merge-refs": "^1.1.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "10c9fd1caacf98a5c15f84529889ddf41e9e1b54"
|
|
29
29
|
}
|