@alfalab/core-components-calendar-range 7.0.12 → 7.0.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index_module = require('./index.module-0cee42f1.js');
3
+ var index_module = require('./index.module-5ed7938a.js');
4
4
  var React = require('react');
5
5
  var views_popover = require('./views/popover.js');
6
6
  var views_static = require('./views/static.js');
@@ -16,6 +16,7 @@ require('date-fns/max');
16
16
  require('date-fns/min');
17
17
  require('date-fns/subMonths');
18
18
  require('date-fns/endOfMonth');
19
+ require('date-fns/isSameMonth');
19
20
  require('@alfalab/core-components-calendar');
20
21
  require('./utils.js');
21
22
 
@@ -8,7 +8,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
8
8
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
9
9
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
10
10
 
11
- var styles = {"component":"calendar-range__component_eslzr","outer":"calendar-range__outer_eslzr","s":"calendar-range__s_eslzr","m":"calendar-range__m_eslzr","l":"calendar-range__l_eslzr","xl":"calendar-range__xl_eslzr"};
11
+ var styles = {"component":"calendar-range__component_1ohku","outer":"calendar-range__outer_1ohku","s":"calendar-range__s_1ohku","m":"calendar-range__m_1ohku","l":"calendar-range__l_1ohku","xl":"calendar-range__xl_1ohku"};
12
12
  require('./index.css')
13
13
 
14
14
  var Divider = function (_a) {
@@ -1,25 +1,26 @@
1
- /* hash: 4tn7w */
1
+ /* hash: k84x9 */
2
2
  :root {
3
+ } /* deprecated */ :root {
3
4
  --color-light-graphic-primary: #0b1f35;
4
- }
5
- :root {
5
+ } :root {
6
+ } :root {
7
+ } :root {
6
8
 
7
9
  /* Hard */
8
10
 
9
11
  /* Up */
10
12
 
11
13
  /* Hard up */
12
- }
13
- :root {
14
+ } :root {
15
+ } :root {
14
16
  --gap-xs: 8px;
15
- }
16
- :root {
17
+ } :root {
18
+ } :root {
17
19
  --size-s-height: 48px;
18
20
  --size-m-height: 56px;
19
21
  --size-l-height: 64px;
20
22
  --size-xl-height: 72px;
21
- }
22
- :root {
23
+ } :root {
23
24
 
24
25
  /* Кнопки выбора месяцев и годов */
25
26
 
@@ -40,36 +41,29 @@
40
41
  /* disabled */
41
42
 
42
43
  /* marker */
43
- }
44
- .calendar-range__component_eslzr {
44
+ } .calendar-range__component_1ohku {
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
- }
51
- .calendar-range__component_eslzr:after {
50
+ } .calendar-range__component_1ohku:after {
52
51
  content: '';
53
52
  display: block;
54
53
  width: 100%;
55
54
  height: 1px;
56
55
  background-color: var(--color-light-graphic-primary);
57
- }
58
- .calendar-range__outer_eslzr {
56
+ } .calendar-range__outer_1ohku {
59
57
  position: relative;
60
58
 
61
59
  /* FormControl .above height + margin-bottom */
62
60
  top: 24px;
63
- }
64
- .calendar-range__s_eslzr {
61
+ } .calendar-range__s_1ohku {
65
62
  height: var(--size-s-height);
66
- }
67
- .calendar-range__m_eslzr {
63
+ } .calendar-range__m_1ohku {
68
64
  height: var(--size-m-height);
69
- }
70
- .calendar-range__l_eslzr {
65
+ } .calendar-range__l_1ohku {
71
66
  height: var(--size-l-height);
72
- }
73
- .calendar-range__xl_eslzr {
67
+ } .calendar-range__xl_1ohku {
74
68
  height: var(--size-xl-height);
75
69
  }
package/cssm/Component.js CHANGED
@@ -18,6 +18,7 @@ require('date-fns/min');
18
18
  require('date-fns/subMonths');
19
19
  require('./views/index.module.css');
20
20
  require('date-fns/endOfMonth');
21
+ require('date-fns/isSameMonth');
21
22
  require('@alfalab/core-components-calendar/cssm');
22
23
  require('./utils.js');
23
24
 
@@ -1,24 +1,25 @@
1
1
  :root {
2
+ } /* deprecated */ :root {
2
3
  --color-light-graphic-primary: #0b1f35;
3
- }
4
- :root {
4
+ } :root {
5
+ } :root {
6
+ } :root {
5
7
 
6
8
  /* Hard */
7
9
 
8
10
  /* Up */
9
11
 
10
12
  /* Hard up */
11
- }
12
- :root {
13
+ } :root {
14
+ } :root {
13
15
  --gap-xs: 8px;
14
- }
15
- :root {
16
+ } :root {
17
+ } :root {
16
18
  --size-s-height: 48px;
17
19
  --size-m-height: 56px;
18
20
  --size-l-height: 64px;
19
21
  --size-xl-height: 72px;
20
- }
21
- :root {
22
+ } :root {
22
23
 
23
24
  /* Кнопки выбора месяцев и годов */
24
25
 
@@ -39,36 +40,29 @@
39
40
  /* disabled */
40
41
 
41
42
  /* marker */
42
- }
43
- .component {
43
+ } .component {
44
44
  display: flex;
45
45
  align-items: center;
46
46
  justify-content: center;
47
47
  width: 16px;
48
48
  margin: 0 var(--gap-xs)
49
- }
50
- .component:after {
49
+ } .component:after {
51
50
  content: '';
52
51
  display: block;
53
52
  width: 100%;
54
53
  height: 1px;
55
54
  background-color: var(--color-light-graphic-primary);
56
- }
57
- .outer {
55
+ } .outer {
58
56
  position: relative;
59
57
 
60
58
  /* FormControl .above height + margin-bottom */
61
59
  top: 24px;
62
- }
63
- .s {
60
+ } .s {
64
61
  height: var(--size-s-height);
65
- }
66
- .m {
62
+ } .m {
67
63
  height: var(--size-m-height);
68
- }
69
- .l {
64
+ } .l {
70
65
  height: var(--size-l-height);
71
- }
72
- .xl {
66
+ } .xl {
73
67
  height: var(--size-xl-height);
74
68
  }
package/cssm/index.js CHANGED
@@ -19,6 +19,7 @@ require('date-fns/subMonths');
19
19
  require('./views/index.module.css');
20
20
  require('./views/static.js');
21
21
  require('date-fns/endOfMonth');
22
+ require('date-fns/isSameMonth');
22
23
  require('@alfalab/core-components-calendar/cssm');
23
24
  require('./utils.js');
24
25
 
@@ -1,12 +1,19 @@
1
1
  :root {
2
+ } /* deprecated */ :root {
3
+ } :root {
4
+ } :root {
5
+ } :root {
2
6
 
3
7
  /* Hard */
4
8
 
5
9
  /* Up */
6
10
 
7
11
  /* Hard up */
8
- }
9
- :root {
12
+ } :root {
13
+ } :root {
14
+ } :root {
15
+ } :root {
16
+ } :root {
10
17
  --calendar-inner-width: 280px;
11
18
 
12
19
  /* Кнопки выбора месяцев и годов */
@@ -28,19 +35,14 @@
28
35
  /* disabled */
29
36
 
30
37
  /* marker */
31
- }
32
- .component {
38
+ } .component {
33
39
  display: flex
34
- }
35
- .component button[aria-selected='true'] {
40
+ } .component button[aria-selected='true'] {
36
41
  cursor: pointer;
37
- }
38
- .component *[class*='errorIcon_'] {
42
+ } .component *[class*='errorIcon_'] {
39
43
  display: none;
40
- }
41
- .component *[class*='calendarIcon_'] {
44
+ } .component *[class*='calendarIcon_'] {
42
45
  margin-right: 0;
43
- }
44
- .static .calendar {
46
+ } .static .calendar {
45
47
  width: var(--calendar-inner-width);
46
48
  }
@@ -5,6 +5,7 @@ var React = require('react');
5
5
  var cn = require('classnames');
6
6
  var addMonths = require('date-fns/addMonths');
7
7
  var endOfMonth = require('date-fns/endOfMonth');
8
+ var isSameMonth = require('date-fns/isSameMonth');
8
9
  var max = require('date-fns/max');
9
10
  var startOfMonth = require('date-fns/startOfMonth');
10
11
  var subMonths = require('date-fns/subMonths');
@@ -25,6 +26,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
25
26
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
26
27
  var addMonths__default = /*#__PURE__*/_interopDefaultCompat(addMonths);
27
28
  var endOfMonth__default = /*#__PURE__*/_interopDefaultCompat(endOfMonth);
29
+ var isSameMonth__default = /*#__PURE__*/_interopDefaultCompat(isSameMonth);
28
30
  var max__default = /*#__PURE__*/_interopDefaultCompat(max);
29
31
  var startOfMonth__default = /*#__PURE__*/_interopDefaultCompat(startOfMonth);
30
32
  var subMonths__default = /*#__PURE__*/_interopDefaultCompat(subMonths);
@@ -159,6 +161,7 @@ var CalendarRangeStatic = function (_a) {
159
161
  var calendarToProps = inputToProps.calendarProps, dateInputToProps = tslib_es6.__rest(inputToProps, ["calendarProps"]);
160
162
  var CalendarFromComponent = dateInputFromProps.Calendar || coreComponentsCalendar.Calendar;
161
163
  var CalendarToComponent = dateInputToProps.Calendar || coreComponentsCalendar.Calendar;
164
+ var minMaxInSameMonth = minDate && maxDate && isSameMonth__default.default(minDate, maxDate);
162
165
  return (
163
166
  // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
164
167
  React__default.default.createElement("div", { className: cn__default.default(styles__default.default.component, styles__default.default.static, className), onMouseOver: handleMouseOver, "data-test-id": dataTestId },
@@ -166,13 +169,17 @@ var CalendarRangeStatic = function (_a) {
166
169
  React__default.default.createElement(coreComponentsDateInput.DateInput, tslib_es6.__assign({}, dateInputFromProps, { mobileMode: dateInputFromProps.mobileMode === 'popover'
167
170
  ? 'input'
168
171
  : dateInputFromProps.mobileMode, value: inputFromValue, onChange: handleInputFromChange, onClear: handleClearFrom, onBlur: handleValidInputFrom, error: bothInvalid || inputFromInvalid || dateInputFromProps.error, clear: true, block: true })),
169
- React__default.default.createElement(CalendarFromComponent, tslib_es6.__assign({}, calendarFromProps, { className: cn__default.default(styles__default.default.calendar, calendarFromProps === null || calendarFromProps === void 0 ? void 0 : calendarFromProps.className), month: monthFrom, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthFromChange, minDate: minDate, maxDate: maxDate && max__default.default([maxDate, endOfMonth__default.default(subMonths__default.default(maxDate, 1))]).getTime() }, rangeProps))),
172
+ React__default.default.createElement(CalendarFromComponent, tslib_es6.__assign({}, calendarFromProps, { className: cn__default.default(styles__default.default.calendar, calendarFromProps === null || calendarFromProps === void 0 ? void 0 : calendarFromProps.className), month: monthFrom, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthFromChange, minDate: minDate, maxDate: minMaxInSameMonth
173
+ ? maxDate
174
+ : maxDate && max__default.default([maxDate, endOfMonth__default.default(subMonths__default.default(maxDate, 1))]).getTime() }, rangeProps))),
170
175
  React__default.default.createElement(components_divider_Component.Divider, { inputFromProps: inputFromProps, inputToProps: inputToProps }),
171
176
  React__default.default.createElement("div", null,
172
177
  React__default.default.createElement(coreComponentsDateInput.DateInput, tslib_es6.__assign({}, dateInputToProps, { mobileMode: dateInputToProps.mobileMode === 'popover'
173
178
  ? 'input'
174
179
  : dateInputToProps.mobileMode, value: inputToValue, onChange: handleInputToChange, onClear: handleClearTo, onBlur: handleValidInputTo, error: bothInvalid || inputToInvalid, clear: true, block: true })),
175
- React__default.default.createElement(CalendarToComponent, tslib_es6.__assign({}, calendarToProps, { className: cn__default.default(styles__default.default.calendar, calendarToProps === null || calendarToProps === void 0 ? void 0 : calendarToProps.className), month: monthTo, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthToChange, minDate: minDate && startOfMonth__default.default(addMonths__default.default(minDate, 1)).getTime(), maxDate: maxDate }, rangeProps)))));
180
+ React__default.default.createElement(CalendarToComponent, tslib_es6.__assign({}, calendarToProps, { className: cn__default.default(styles__default.default.calendar, calendarToProps === null || calendarToProps === void 0 ? void 0 : calendarToProps.className), month: monthTo, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthToChange, minDate: minMaxInSameMonth
181
+ ? minDate
182
+ : minDate && startOfMonth__default.default(addMonths__default.default(minDate, 1)).getTime(), maxDate: maxDate }, rangeProps)))));
176
183
  };
177
184
 
178
185
  exports.CalendarRangeStatic = CalendarRangeStatic;
package/esm/Component.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as __rest, a as __assign } from './index.module-3369c8fe.js';
1
+ import { _ as __rest, a as __assign } from './index.module-b652d776.js';
2
2
  import React from 'react';
3
3
  import { CalendarRangePopover } from './views/popover.js';
4
4
  import { CalendarRangeStatic } from './views/static.js';
@@ -14,6 +14,7 @@ import 'date-fns/max';
14
14
  import 'date-fns/min';
15
15
  import 'date-fns/subMonths';
16
16
  import 'date-fns/endOfMonth';
17
+ import 'date-fns/isSameMonth';
17
18
  import '@alfalab/core-components-calendar/esm';
18
19
  import './utils.js';
19
20
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
- var styles = {"component":"calendar-range__component_eslzr","outer":"calendar-range__outer_eslzr","s":"calendar-range__s_eslzr","m":"calendar-range__m_eslzr","l":"calendar-range__l_eslzr","xl":"calendar-range__xl_eslzr"};
4
+ var styles = {"component":"calendar-range__component_1ohku","outer":"calendar-range__outer_1ohku","s":"calendar-range__s_1ohku","m":"calendar-range__m_1ohku","l":"calendar-range__l_1ohku","xl":"calendar-range__xl_1ohku"};
5
5
  require('./index.css')
6
6
 
7
7
  var Divider = function (_a) {
@@ -1,25 +1,26 @@
1
- /* hash: 4tn7w */
1
+ /* hash: k84x9 */
2
2
  :root {
3
+ } /* deprecated */ :root {
3
4
  --color-light-graphic-primary: #0b1f35;
4
- }
5
- :root {
5
+ } :root {
6
+ } :root {
7
+ } :root {
6
8
 
7
9
  /* Hard */
8
10
 
9
11
  /* Up */
10
12
 
11
13
  /* Hard up */
12
- }
13
- :root {
14
+ } :root {
15
+ } :root {
14
16
  --gap-xs: 8px;
15
- }
16
- :root {
17
+ } :root {
18
+ } :root {
17
19
  --size-s-height: 48px;
18
20
  --size-m-height: 56px;
19
21
  --size-l-height: 64px;
20
22
  --size-xl-height: 72px;
21
- }
22
- :root {
23
+ } :root {
23
24
 
24
25
  /* Кнопки выбора месяцев и годов */
25
26
 
@@ -40,36 +41,29 @@
40
41
  /* disabled */
41
42
 
42
43
  /* marker */
43
- }
44
- .calendar-range__component_eslzr {
44
+ } .calendar-range__component_1ohku {
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
- }
51
- .calendar-range__component_eslzr:after {
50
+ } .calendar-range__component_1ohku:after {
52
51
  content: '';
53
52
  display: block;
54
53
  width: 100%;
55
54
  height: 1px;
56
55
  background-color: var(--color-light-graphic-primary);
57
- }
58
- .calendar-range__outer_eslzr {
56
+ } .calendar-range__outer_1ohku {
59
57
  position: relative;
60
58
 
61
59
  /* FormControl .above height + margin-bottom */
62
60
  top: 24px;
63
- }
64
- .calendar-range__s_eslzr {
61
+ } .calendar-range__s_1ohku {
65
62
  height: var(--size-s-height);
66
- }
67
- .calendar-range__m_eslzr {
63
+ } .calendar-range__m_1ohku {
68
64
  height: var(--size-m-height);
69
- }
70
- .calendar-range__l_eslzr {
65
+ } .calendar-range__l_1ohku {
71
66
  height: var(--size-l-height);
72
- }
73
- .calendar-range__xl_eslzr {
67
+ } .calendar-range__xl_1ohku {
74
68
  height: var(--size-xl-height);
75
69
  }
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CalendarRange } from './Component.js';
2
- import './index.module-3369c8fe.js';
2
+ import './index.module-b652d776.js';
3
3
  import 'react';
4
4
  import './views/popover.js';
5
5
  import 'classnames';
@@ -15,5 +15,6 @@ import 'date-fns/min';
15
15
  import 'date-fns/subMonths';
16
16
  import './views/static.js';
17
17
  import 'date-fns/endOfMonth';
18
+ import 'date-fns/isSameMonth';
18
19
  import '@alfalab/core-components-calendar/esm';
19
20
  import './utils.js';
@@ -37,7 +37,7 @@ function __rest(s, e) {
37
37
  return t;
38
38
  }
39
39
 
40
- var styles = {"component":"calendar-range__component_19i4n","static":"calendar-range__static_19i4n","calendar":"calendar-range__calendar_19i4n"};
40
+ var styles = {"component":"calendar-range__component_17o7z","static":"calendar-range__static_17o7z","calendar":"calendar-range__calendar_17o7z"};
41
41
  require('./views/index.css')
42
42
 
43
43
  export { __rest as _, __assign as a, styles as s };
@@ -1,13 +1,20 @@
1
- /* hash: 1na7b */
1
+ /* hash: 3nkzb */
2
2
  :root {
3
+ } /* deprecated */ :root {
4
+ } :root {
5
+ } :root {
6
+ } :root {
3
7
 
4
8
  /* Hard */
5
9
 
6
10
  /* Up */
7
11
 
8
12
  /* Hard up */
9
- }
10
- :root {
13
+ } :root {
14
+ } :root {
15
+ } :root {
16
+ } :root {
17
+ } :root {
11
18
  --calendar-inner-width: 280px;
12
19
 
13
20
  /* Кнопки выбора месяцев и годов */
@@ -29,19 +36,14 @@
29
36
  /* disabled */
30
37
 
31
38
  /* marker */
32
- }
33
- .calendar-range__component_19i4n {
39
+ } .calendar-range__component_17o7z {
34
40
  display: flex
35
- }
36
- .calendar-range__component_19i4n button[aria-selected='true'] {
41
+ } .calendar-range__component_17o7z button[aria-selected='true'] {
37
42
  cursor: pointer;
38
- }
39
- .calendar-range__component_19i4n *[class*='errorIcon_'] {
43
+ } .calendar-range__component_17o7z *[class*='errorIcon_'] {
40
44
  display: none;
41
- }
42
- .calendar-range__component_19i4n *[class*='calendarIcon_'] {
45
+ } .calendar-range__component_17o7z *[class*='calendarIcon_'] {
43
46
  margin-right: 0;
44
- }
45
- .calendar-range__static_19i4n .calendar-range__calendar_19i4n {
47
+ } .calendar-range__static_17o7z .calendar-range__calendar_17o7z {
46
48
  width: var(--calendar-inner-width);
47
49
  }
@@ -1,4 +1,4 @@
1
- import { s as styles, a as __assign } from '../index.module-3369c8fe.js';
1
+ import { s as styles, a as __assign } from '../index.module-b652d776.js';
2
2
  import React, { useState, useCallback, useEffect } from 'react';
3
3
  import cn from 'classnames';
4
4
  import startOfMonth from 'date-fns/startOfMonth';
@@ -1,8 +1,9 @@
1
- import { _ as __rest, s as styles, a as __assign } from '../index.module-3369c8fe.js';
1
+ import { _ as __rest, s as styles, a as __assign } from '../index.module-b652d776.js';
2
2
  import React, { useState, useCallback, useEffect } from 'react';
3
3
  import cn from 'classnames';
4
4
  import addMonths from 'date-fns/addMonths';
5
5
  import endOfMonth from 'date-fns/endOfMonth';
6
+ import isSameMonth from 'date-fns/isSameMonth';
6
7
  import max from 'date-fns/max';
7
8
  import startOfMonth from 'date-fns/startOfMonth';
8
9
  import subMonths from 'date-fns/subMonths';
@@ -144,6 +145,7 @@ var CalendarRangeStatic = function (_a) {
144
145
  var calendarToProps = inputToProps.calendarProps, dateInputToProps = __rest(inputToProps, ["calendarProps"]);
145
146
  var CalendarFromComponent = dateInputFromProps.Calendar || Calendar;
146
147
  var CalendarToComponent = dateInputToProps.Calendar || Calendar;
148
+ var minMaxInSameMonth = minDate && maxDate && isSameMonth(minDate, maxDate);
147
149
  return (
148
150
  // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
149
151
  React.createElement("div", { className: cn(styles.component, styles.static, className), onMouseOver: handleMouseOver, "data-test-id": dataTestId },
@@ -151,13 +153,17 @@ var CalendarRangeStatic = function (_a) {
151
153
  React.createElement(DateInput, __assign({}, dateInputFromProps, { mobileMode: dateInputFromProps.mobileMode === 'popover'
152
154
  ? 'input'
153
155
  : dateInputFromProps.mobileMode, value: inputFromValue, onChange: handleInputFromChange, onClear: handleClearFrom, onBlur: handleValidInputFrom, error: bothInvalid || inputFromInvalid || dateInputFromProps.error, clear: true, block: true })),
154
- React.createElement(CalendarFromComponent, __assign({}, calendarFromProps, { className: cn(styles.calendar, calendarFromProps === null || calendarFromProps === void 0 ? void 0 : calendarFromProps.className), month: monthFrom, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthFromChange, minDate: minDate, maxDate: maxDate && max([maxDate, endOfMonth(subMonths(maxDate, 1))]).getTime() }, rangeProps))),
156
+ React.createElement(CalendarFromComponent, __assign({}, calendarFromProps, { className: cn(styles.calendar, calendarFromProps === null || calendarFromProps === void 0 ? void 0 : calendarFromProps.className), month: monthFrom, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthFromChange, minDate: minDate, maxDate: minMaxInSameMonth
157
+ ? maxDate
158
+ : maxDate && max([maxDate, endOfMonth(subMonths(maxDate, 1))]).getTime() }, rangeProps))),
155
159
  React.createElement(Divider, { inputFromProps: inputFromProps, inputToProps: inputToProps }),
156
160
  React.createElement("div", null,
157
161
  React.createElement(DateInput, __assign({}, dateInputToProps, { mobileMode: dateInputToProps.mobileMode === 'popover'
158
162
  ? 'input'
159
163
  : dateInputToProps.mobileMode, value: inputToValue, onChange: handleInputToChange, onClear: handleClearTo, onBlur: handleValidInputTo, error: bothInvalid || inputToInvalid, clear: true, block: true })),
160
- React.createElement(CalendarToComponent, __assign({}, calendarToProps, { className: cn(styles.calendar, calendarToProps === null || calendarToProps === void 0 ? void 0 : calendarToProps.className), month: monthTo, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthToChange, minDate: minDate && startOfMonth(addMonths(minDate, 1)).getTime(), maxDate: maxDate }, rangeProps)))));
164
+ React.createElement(CalendarToComponent, __assign({}, calendarToProps, { className: cn(styles.calendar, calendarToProps === null || calendarToProps === void 0 ? void 0 : calendarToProps.className), month: monthTo, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthToChange, minDate: minMaxInSameMonth
165
+ ? minDate
166
+ : minDate && startOfMonth(addMonths(minDate, 1)).getTime(), maxDate: maxDate }, rangeProps)))));
161
167
  };
162
168
 
163
169
  export { CalendarRangeStatic };
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var Component = require('./Component.js');
4
- require('./index.module-0cee42f1.js');
4
+ require('./index.module-5ed7938a.js');
5
5
  require('react');
6
6
  require('./views/popover.js');
7
7
  require('classnames');
@@ -17,6 +17,7 @@ require('date-fns/min');
17
17
  require('date-fns/subMonths');
18
18
  require('./views/static.js');
19
19
  require('date-fns/endOfMonth');
20
+ require('date-fns/isSameMonth');
20
21
  require('@alfalab/core-components-calendar');
21
22
  require('./utils.js');
22
23
 
@@ -39,7 +39,7 @@ function __rest(s, e) {
39
39
  return t;
40
40
  }
41
41
 
42
- var styles = {"component":"calendar-range__component_19i4n","static":"calendar-range__static_19i4n","calendar":"calendar-range__calendar_19i4n"};
42
+ var styles = {"component":"calendar-range__component_17o7z","static":"calendar-range__static_17o7z","calendar":"calendar-range__calendar_17o7z"};
43
43
  require('./views/index.css')
44
44
 
45
45
  exports.__rest = __rest;
@@ -12,8 +12,9 @@ import 'date-fns/isEqual';
12
12
  import 'date-fns/max';
13
13
  import 'date-fns/min';
14
14
  import 'date-fns/subMonths';
15
- import './index.module-249f068b.js';
15
+ import './index.module-c9c640cc.js';
16
16
  import 'date-fns/endOfMonth';
17
+ import 'date-fns/isSameMonth';
17
18
  import '@alfalab/core-components-calendar/modern';
18
19
  import './utils.js';
19
20
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
- const styles = {"component":"calendar-range__component_eslzr","outer":"calendar-range__outer_eslzr","s":"calendar-range__s_eslzr","m":"calendar-range__m_eslzr","l":"calendar-range__l_eslzr","xl":"calendar-range__xl_eslzr"};
4
+ const styles = {"component":"calendar-range__component_1ohku","outer":"calendar-range__outer_1ohku","s":"calendar-range__s_1ohku","m":"calendar-range__m_1ohku","l":"calendar-range__l_1ohku","xl":"calendar-range__xl_1ohku"};
5
5
  require('./index.css')
6
6
 
7
7
  const Divider = ({ inputFromProps, inputToProps }) => {
@@ -1,25 +1,26 @@
1
- /* hash: 4tn7w */
1
+ /* hash: k84x9 */
2
2
  :root {
3
+ } /* deprecated */ :root {
3
4
  --color-light-graphic-primary: #0b1f35;
4
- }
5
- :root {
5
+ } :root {
6
+ } :root {
7
+ } :root {
6
8
 
7
9
  /* Hard */
8
10
 
9
11
  /* Up */
10
12
 
11
13
  /* Hard up */
12
- }
13
- :root {
14
+ } :root {
15
+ } :root {
14
16
  --gap-xs: 8px;
15
- }
16
- :root {
17
+ } :root {
18
+ } :root {
17
19
  --size-s-height: 48px;
18
20
  --size-m-height: 56px;
19
21
  --size-l-height: 64px;
20
22
  --size-xl-height: 72px;
21
- }
22
- :root {
23
+ } :root {
23
24
 
24
25
  /* Кнопки выбора месяцев и годов */
25
26
 
@@ -40,36 +41,29 @@
40
41
  /* disabled */
41
42
 
42
43
  /* marker */
43
- }
44
- .calendar-range__component_eslzr {
44
+ } .calendar-range__component_1ohku {
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
- }
51
- .calendar-range__component_eslzr:after {
50
+ } .calendar-range__component_1ohku:after {
52
51
  content: '';
53
52
  display: block;
54
53
  width: 100%;
55
54
  height: 1px;
56
55
  background-color: var(--color-light-graphic-primary);
57
- }
58
- .calendar-range__outer_eslzr {
56
+ } .calendar-range__outer_1ohku {
59
57
  position: relative;
60
58
 
61
59
  /* FormControl .above height + margin-bottom */
62
60
  top: 24px;
63
- }
64
- .calendar-range__s_eslzr {
61
+ } .calendar-range__s_1ohku {
65
62
  height: var(--size-s-height);
66
- }
67
- .calendar-range__m_eslzr {
63
+ } .calendar-range__m_1ohku {
68
64
  height: var(--size-m-height);
69
- }
70
- .calendar-range__l_eslzr {
65
+ } .calendar-range__l_1ohku {
71
66
  height: var(--size-l-height);
72
- }
73
- .calendar-range__xl_eslzr {
67
+ } .calendar-range__xl_1ohku {
74
68
  height: var(--size-xl-height);
75
69
  }
package/modern/index.js CHANGED
@@ -12,8 +12,9 @@ import 'date-fns/isEqual';
12
12
  import 'date-fns/max';
13
13
  import 'date-fns/min';
14
14
  import 'date-fns/subMonths';
15
- import './index.module-249f068b.js';
15
+ import './index.module-c9c640cc.js';
16
16
  import './views/static.js';
17
17
  import 'date-fns/endOfMonth';
18
+ import 'date-fns/isSameMonth';
18
19
  import '@alfalab/core-components-calendar/modern';
19
20
  import './utils.js';
@@ -0,0 +1,4 @@
1
+ const styles = {"component":"calendar-range__component_17o7z","static":"calendar-range__static_17o7z","calendar":"calendar-range__calendar_17o7z"};
2
+ require('./views/index.css')
3
+
4
+ export { styles as s };
@@ -1,13 +1,20 @@
1
- /* hash: 1na7b */
1
+ /* hash: 3nkzb */
2
2
  :root {
3
+ } /* deprecated */ :root {
4
+ } :root {
5
+ } :root {
6
+ } :root {
3
7
 
4
8
  /* Hard */
5
9
 
6
10
  /* Up */
7
11
 
8
12
  /* Hard up */
9
- }
10
- :root {
13
+ } :root {
14
+ } :root {
15
+ } :root {
16
+ } :root {
17
+ } :root {
11
18
  --calendar-inner-width: 280px;
12
19
 
13
20
  /* Кнопки выбора месяцев и годов */
@@ -29,19 +36,14 @@
29
36
  /* disabled */
30
37
 
31
38
  /* marker */
32
- }
33
- .calendar-range__component_19i4n {
39
+ } .calendar-range__component_17o7z {
34
40
  display: flex
35
- }
36
- .calendar-range__component_19i4n button[aria-selected='true'] {
41
+ } .calendar-range__component_17o7z button[aria-selected='true'] {
37
42
  cursor: pointer;
38
- }
39
- .calendar-range__component_19i4n *[class*='errorIcon_'] {
43
+ } .calendar-range__component_17o7z *[class*='errorIcon_'] {
40
44
  display: none;
41
- }
42
- .calendar-range__component_19i4n *[class*='calendarIcon_'] {
45
+ } .calendar-range__component_17o7z *[class*='calendarIcon_'] {
43
46
  margin-right: 0;
44
- }
45
- .calendar-range__static_19i4n .calendar-range__calendar_19i4n {
47
+ } .calendar-range__static_17o7z .calendar-range__calendar_17o7z {
46
48
  width: var(--calendar-inner-width);
47
49
  }
@@ -5,7 +5,7 @@ import { isValidInputValue, parseDateString, CalendarInput } from '@alfalab/core
5
5
  import { isCompleteDateInput } from '@alfalab/core-components-date-input/modern';
6
6
  import { Divider } from '../components/divider/Component.js';
7
7
  import { usePopoverViewMonthes } from '../hooks.js';
8
- import { s as styles } from '../index.module-249f068b.js';
8
+ import { s as styles } from '../index.module-c9c640cc.js';
9
9
  import 'date-fns/addMonths';
10
10
  import 'date-fns/isEqual';
11
11
  import 'date-fns/max';
@@ -2,6 +2,7 @@ import React, { useState, useCallback, useEffect } from 'react';
2
2
  import cn from 'classnames';
3
3
  import addMonths from 'date-fns/addMonths';
4
4
  import endOfMonth from 'date-fns/endOfMonth';
5
+ import isSameMonth from 'date-fns/isSameMonth';
5
6
  import max from 'date-fns/max';
6
7
  import startOfMonth from 'date-fns/startOfMonth';
7
8
  import subMonths from 'date-fns/subMonths';
@@ -11,7 +12,7 @@ import { isCompleteDateInput, DateInput } from '@alfalab/core-components-date-in
11
12
  import { Divider } from '../components/divider/Component.js';
12
13
  import { useStaticViewMonthes, useSelectionProps } from '../hooks.js';
13
14
  import { isDayButton } from '../utils.js';
14
- import { s as styles } from '../index.module-249f068b.js';
15
+ import { s as styles } from '../index.module-c9c640cc.js';
15
16
  import 'date-fns/isEqual';
16
17
  import 'date-fns/min';
17
18
 
@@ -144,6 +145,7 @@ const CalendarRangeStatic = ({ className, defaultMonth = startOfMonth(new Date()
144
145
  const { calendarProps: calendarToProps, ...dateInputToProps } = inputToProps;
145
146
  const CalendarFromComponent = dateInputFromProps.Calendar || Calendar;
146
147
  const CalendarToComponent = dateInputToProps.Calendar || Calendar;
148
+ const minMaxInSameMonth = minDate && maxDate && isSameMonth(minDate, maxDate);
147
149
  return (
148
150
  // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
149
151
  React.createElement("div", { className: cn(styles.component, styles.static, className), onMouseOver: handleMouseOver, "data-test-id": dataTestId },
@@ -151,13 +153,17 @@ const CalendarRangeStatic = ({ className, defaultMonth = startOfMonth(new Date()
151
153
  React.createElement(DateInput, { ...dateInputFromProps, mobileMode: dateInputFromProps.mobileMode === 'popover'
152
154
  ? 'input'
153
155
  : dateInputFromProps.mobileMode, value: inputFromValue, onChange: handleInputFromChange, onClear: handleClearFrom, onBlur: handleValidInputFrom, error: bothInvalid || inputFromInvalid || dateInputFromProps.error, clear: true, block: true }),
154
- React.createElement(CalendarFromComponent, { ...calendarFromProps, className: cn(styles.calendar, calendarFromProps?.className), month: monthFrom, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthFromChange, minDate: minDate, maxDate: maxDate && max([maxDate, endOfMonth(subMonths(maxDate, 1))]).getTime(), ...rangeProps })),
156
+ React.createElement(CalendarFromComponent, { ...calendarFromProps, className: cn(styles.calendar, calendarFromProps?.className), month: monthFrom, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthFromChange, minDate: minDate, maxDate: minMaxInSameMonth
157
+ ? maxDate
158
+ : maxDate && max([maxDate, endOfMonth(subMonths(maxDate, 1))]).getTime(), ...rangeProps })),
155
159
  React.createElement(Divider, { inputFromProps: inputFromProps, inputToProps: inputToProps }),
156
160
  React.createElement("div", null,
157
161
  React.createElement(DateInput, { ...dateInputToProps, mobileMode: dateInputToProps.mobileMode === 'popover'
158
162
  ? 'input'
159
163
  : dateInputToProps.mobileMode, value: inputToValue, onChange: handleInputToChange, onClear: handleClearTo, onBlur: handleValidInputTo, error: bothInvalid || inputToInvalid, clear: true, block: true }),
160
- React.createElement(CalendarToComponent, { ...calendarToProps, className: cn(styles.calendar, calendarToProps?.className), month: monthTo, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthToChange, minDate: minDate && startOfMonth(addMonths(minDate, 1)).getTime(), maxDate: maxDate, ...rangeProps }))));
164
+ React.createElement(CalendarToComponent, { ...calendarToProps, className: cn(styles.calendar, calendarToProps?.className), month: monthTo, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthToChange, minDate: minMaxInSameMonth
165
+ ? minDate
166
+ : minDate && startOfMonth(addMonths(minDate, 1)).getTime(), maxDate: maxDate, ...rangeProps }))));
161
167
  };
162
168
 
163
169
  export { CalendarRangeStatic };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-calendar-range",
3
- "version": "7.0.12",
3
+ "version": "7.0.13",
4
4
  "description": "Calendar range component",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  "react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
19
19
  },
20
20
  "dependencies": {
21
- "@alfalab/core-components-calendar": "^6.2.5",
22
- "@alfalab/core-components-calendar-input": "^8.2.5",
21
+ "@alfalab/core-components-calendar": "^6.2.6",
22
+ "@alfalab/core-components-calendar-input": "^8.2.6",
23
23
  "@alfalab/core-components-date-input": "^4.1.4",
24
24
  "classnames": "^2.3.1",
25
25
  "date-fns": "^2.16.1"
package/views/index.css CHANGED
@@ -1,13 +1,20 @@
1
- /* hash: 1na7b */
1
+ /* hash: 3nkzb */
2
2
  :root {
3
+ } /* deprecated */ :root {
4
+ } :root {
5
+ } :root {
6
+ } :root {
3
7
 
4
8
  /* Hard */
5
9
 
6
10
  /* Up */
7
11
 
8
12
  /* Hard up */
9
- }
10
- :root {
13
+ } :root {
14
+ } :root {
15
+ } :root {
16
+ } :root {
17
+ } :root {
11
18
  --calendar-inner-width: 280px;
12
19
 
13
20
  /* Кнопки выбора месяцев и годов */
@@ -29,19 +36,14 @@
29
36
  /* disabled */
30
37
 
31
38
  /* marker */
32
- }
33
- .calendar-range__component_19i4n {
39
+ } .calendar-range__component_17o7z {
34
40
  display: flex
35
- }
36
- .calendar-range__component_19i4n button[aria-selected='true'] {
41
+ } .calendar-range__component_17o7z button[aria-selected='true'] {
37
42
  cursor: pointer;
38
- }
39
- .calendar-range__component_19i4n *[class*='errorIcon_'] {
43
+ } .calendar-range__component_17o7z *[class*='errorIcon_'] {
40
44
  display: none;
41
- }
42
- .calendar-range__component_19i4n *[class*='calendarIcon_'] {
45
+ } .calendar-range__component_17o7z *[class*='calendarIcon_'] {
43
46
  margin-right: 0;
44
- }
45
- .calendar-range__static_19i4n .calendar-range__calendar_19i4n {
47
+ } .calendar-range__static_17o7z .calendar-range__calendar_17o7z {
46
48
  width: var(--calendar-inner-width);
47
49
  }
package/views/popover.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index_module = require('../index.module-0cee42f1.js');
3
+ var index_module = require('../index.module-5ed7938a.js');
4
4
  var React = require('react');
5
5
  var cn = require('classnames');
6
6
  var startOfMonth = require('date-fns/startOfMonth');
package/views/static.js CHANGED
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var index_module = require('../index.module-0cee42f1.js');
3
+ var index_module = require('../index.module-5ed7938a.js');
4
4
  var React = require('react');
5
5
  var cn = require('classnames');
6
6
  var addMonths = require('date-fns/addMonths');
7
7
  var endOfMonth = require('date-fns/endOfMonth');
8
+ var isSameMonth = require('date-fns/isSameMonth');
8
9
  var max = require('date-fns/max');
9
10
  var startOfMonth = require('date-fns/startOfMonth');
10
11
  var subMonths = require('date-fns/subMonths');
@@ -23,6 +24,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
23
24
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
24
25
  var addMonths__default = /*#__PURE__*/_interopDefaultCompat(addMonths);
25
26
  var endOfMonth__default = /*#__PURE__*/_interopDefaultCompat(endOfMonth);
27
+ var isSameMonth__default = /*#__PURE__*/_interopDefaultCompat(isSameMonth);
26
28
  var max__default = /*#__PURE__*/_interopDefaultCompat(max);
27
29
  var startOfMonth__default = /*#__PURE__*/_interopDefaultCompat(startOfMonth);
28
30
  var subMonths__default = /*#__PURE__*/_interopDefaultCompat(subMonths);
@@ -156,6 +158,7 @@ var CalendarRangeStatic = function (_a) {
156
158
  var calendarToProps = inputToProps.calendarProps, dateInputToProps = index_module.__rest(inputToProps, ["calendarProps"]);
157
159
  var CalendarFromComponent = dateInputFromProps.Calendar || coreComponentsCalendar.Calendar;
158
160
  var CalendarToComponent = dateInputToProps.Calendar || coreComponentsCalendar.Calendar;
161
+ var minMaxInSameMonth = minDate && maxDate && isSameMonth__default.default(minDate, maxDate);
159
162
  return (
160
163
  // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
161
164
  React__default.default.createElement("div", { className: cn__default.default(index_module.styles.component, index_module.styles.static, className), onMouseOver: handleMouseOver, "data-test-id": dataTestId },
@@ -163,13 +166,17 @@ var CalendarRangeStatic = function (_a) {
163
166
  React__default.default.createElement(coreComponentsDateInput.DateInput, index_module.__assign({}, dateInputFromProps, { mobileMode: dateInputFromProps.mobileMode === 'popover'
164
167
  ? 'input'
165
168
  : dateInputFromProps.mobileMode, value: inputFromValue, onChange: handleInputFromChange, onClear: handleClearFrom, onBlur: handleValidInputFrom, error: bothInvalid || inputFromInvalid || dateInputFromProps.error, clear: true, block: true })),
166
- React__default.default.createElement(CalendarFromComponent, index_module.__assign({}, calendarFromProps, { className: cn__default.default(index_module.styles.calendar, calendarFromProps === null || calendarFromProps === void 0 ? void 0 : calendarFromProps.className), month: monthFrom, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthFromChange, minDate: minDate, maxDate: maxDate && max__default.default([maxDate, endOfMonth__default.default(subMonths__default.default(maxDate, 1))]).getTime() }, rangeProps))),
169
+ React__default.default.createElement(CalendarFromComponent, index_module.__assign({}, calendarFromProps, { className: cn__default.default(index_module.styles.calendar, calendarFromProps === null || calendarFromProps === void 0 ? void 0 : calendarFromProps.className), month: monthFrom, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthFromChange, minDate: minDate, maxDate: minMaxInSameMonth
170
+ ? maxDate
171
+ : maxDate && max__default.default([maxDate, endOfMonth__default.default(subMonths__default.default(maxDate, 1))]).getTime() }, rangeProps))),
167
172
  React__default.default.createElement(components_divider_Component.Divider, { inputFromProps: inputFromProps, inputToProps: inputToProps }),
168
173
  React__default.default.createElement("div", null,
169
174
  React__default.default.createElement(coreComponentsDateInput.DateInput, index_module.__assign({}, dateInputToProps, { mobileMode: dateInputToProps.mobileMode === 'popover'
170
175
  ? 'input'
171
176
  : dateInputToProps.mobileMode, value: inputToValue, onChange: handleInputToChange, onClear: handleClearTo, onBlur: handleValidInputTo, error: bothInvalid || inputToInvalid, clear: true, block: true })),
172
- React__default.default.createElement(CalendarToComponent, index_module.__assign({}, calendarToProps, { className: cn__default.default(index_module.styles.calendar, calendarToProps === null || calendarToProps === void 0 ? void 0 : calendarToProps.className), month: monthTo, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthToChange, minDate: minDate && startOfMonth__default.default(addMonths__default.default(minDate, 1)).getTime(), maxDate: maxDate }, rangeProps)))));
177
+ React__default.default.createElement(CalendarToComponent, index_module.__assign({}, calendarToProps, { className: cn__default.default(index_module.styles.calendar, calendarToProps === null || calendarToProps === void 0 ? void 0 : calendarToProps.className), month: monthTo, selectorView: 'month-only', offDays: offDays, events: events, onChange: period.updatePeriod, onMonthChange: handleMonthToChange, minDate: minMaxInSameMonth
178
+ ? minDate
179
+ : minDate && startOfMonth__default.default(addMonths__default.default(minDate, 1)).getTime(), maxDate: maxDate }, rangeProps)))));
173
180
  };
174
181
 
175
182
  exports.CalendarRangeStatic = CalendarRangeStatic;
@@ -1,4 +0,0 @@
1
- const styles = {"component":"calendar-range__component_19i4n","static":"calendar-range__static_19i4n","calendar":"calendar-range__calendar_19i4n"};
2
- require('./views/index.css')
3
-
4
- export { styles as s };