@megafon/ui-core 6.0.1 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
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
+ # [6.1.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@6.0.1...@megafon/ui-core@6.1.0) (2024-08-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **banner:** fix size of arrows in banner ([8f8cce6](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/8f8cce6f854ab38961481610059ce70593930d40))
12
+
13
+
14
+ ### Features
15
+
16
+ * **calendar:** add new props to component Calendar ([9295261](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/92952617c9f6090691d1911372669657afb993e3))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [6.0.1](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@6.0.0...@megafon/ui-core@6.0.1) (2024-08-05)
7
23
 
8
24
  **Note:** Version bump only for package @megafon/ui-core
@@ -39,7 +39,7 @@
39
39
  .mfui-banner_auto-height .mfui-banner__slide {
40
40
  height: auto;
41
41
  }
42
- .mfui-banner__arrow {
42
+ .mfui-banner .mfui-banner__arrow {
43
43
  position: absolute;
44
44
  top: 50%;
45
45
  z-index: 10;
@@ -48,60 +48,60 @@
48
48
  transition: scale 0.2s linear;
49
49
  }
50
50
  @media screen and (max-width: 767px) {
51
- .mfui-banner__arrow {
51
+ .mfui-banner .mfui-banner__arrow {
52
52
  display: none;
53
53
  }
54
54
  }
55
- .mfui-banner__arrow_theme_white {
55
+ .mfui-banner .mfui-banner__arrow_theme_white {
56
56
  width: 64px;
57
57
  height: 64px;
58
58
  }
59
59
  @media screen and (max-width: 1023px) {
60
- .mfui-banner__arrow_theme_white {
60
+ .mfui-banner .mfui-banner__arrow_theme_white {
61
61
  display: none;
62
62
  }
63
63
  }
64
- .mfui-banner__arrow_prev {
64
+ .mfui-banner .mfui-banner__arrow_prev {
65
65
  left: 12px;
66
66
  }
67
67
  @media screen and (max-width: 767px) {
68
- .mfui-banner__arrow_prev {
68
+ .mfui-banner .mfui-banner__arrow_prev {
69
69
  left: 8px;
70
70
  }
71
71
  }
72
72
  @media screen and (min-width: 768px) and (max-width: 1023px) {
73
- .mfui-banner__arrow_prev {
73
+ .mfui-banner .mfui-banner__arrow_prev {
74
74
  left: 16px;
75
75
  }
76
76
  }
77
77
  @media screen and (min-width: 1280px) {
78
- .mfui-banner__arrow_prev {
78
+ .mfui-banner .mfui-banner__arrow_prev {
79
79
  left: 20px;
80
80
  }
81
81
  }
82
- .mfui-banner__arrow_next {
82
+ .mfui-banner .mfui-banner__arrow_next {
83
83
  right: 12px;
84
84
  }
85
85
  @media screen and (max-width: 767px) {
86
- .mfui-banner__arrow_next {
86
+ .mfui-banner .mfui-banner__arrow_next {
87
87
  right: 8px;
88
88
  }
89
89
  }
90
90
  @media screen and (min-width: 768px) and (max-width: 1023px) {
91
- .mfui-banner__arrow_next {
91
+ .mfui-banner .mfui-banner__arrow_next {
92
92
  right: 16px;
93
93
  }
94
94
  }
95
95
  @media screen and (min-width: 1280px) {
96
- .mfui-banner__arrow_next {
96
+ .mfui-banner .mfui-banner__arrow_next {
97
97
  right: 20px;
98
98
  }
99
99
  }
100
- .mfui-banner__arrow_prev.mfui-banner__arrow_theme_white {
100
+ .mfui-banner .mfui-banner__arrow_prev.mfui-banner__arrow_theme_white {
101
101
  left: 0;
102
102
  translate: -50% -50%;
103
103
  }
104
- .mfui-banner__arrow_next.mfui-banner__arrow_theme_white {
104
+ .mfui-banner .mfui-banner__arrow_next.mfui-banner__arrow_theme_white {
105
105
  right: 0;
106
106
  translate: 50% -50%;
107
107
  }
@@ -3,3 +3,22 @@
3
3
  display: -ms-inline-flexbox;
4
4
  display: inline-flex;
5
5
  }
6
+ .mfui-calendar_modern {
7
+ display: block;
8
+ width: 364px;
9
+ height: 304px;
10
+ overflow-x: hidden;
11
+ overflow-y: scroll;
12
+ }
13
+ .mfui-calendar_modern::-webkit-scrollbar {
14
+ width: 16px;
15
+ }
16
+ .mfui-calendar_modern::-webkit-scrollbar-thumb {
17
+ border: 6px solid transparent;
18
+ border-radius: 16px;
19
+ background-color: #D8D8D8;
20
+ background-clip: padding-box;
21
+ }
22
+ .mfui-calendar_modern::-webkit-scrollbar-thumb:hover {
23
+ background-color: #999999;
24
+ }
@@ -1,5 +1,16 @@
1
1
  import React from 'react';
2
2
  import './Calendar.less';
3
+ export declare const CalendarTypes: {
4
+ readonly CLASSIC: "Classic";
5
+ readonly MODERN: "Modern";
6
+ };
7
+ export declare const CalendarDirectionTypes: {
8
+ readonly PAST: "past";
9
+ readonly FUTURE: "future";
10
+ readonly BOTH: "both";
11
+ };
12
+ declare type CalendarTypesType = typeof CalendarTypes[keyof typeof CalendarTypes];
13
+ declare type CalendarDirectionType = typeof CalendarDirectionTypes[keyof typeof CalendarDirectionTypes];
3
14
  export interface ICalendarProps {
4
15
  /** Дополнительные data атрибуты к внутренним элементам */
5
16
  dataAttrs?: {
@@ -21,6 +32,14 @@ export interface ICalendarProps {
21
32
  minBookingDate?: Date;
22
33
  /** Блокирует возможность выбора дат после указанной (включительно) */
23
34
  maxBookingDate?: Date;
35
+ /** Тип компонента */
36
+ type?: CalendarTypesType;
37
+ /** Количество месяцев отображаемых перед текущим, не включая его (только для типа Modern) */
38
+ pastMonthsCount?: number;
39
+ /** Количество месяцев отображаемых после текущего, не включая его (только для типа Modern) */
40
+ futureMonthsCount?: number;
41
+ /** Направление, в котором отображаются месяцы в календаре (только для типа Modern) */
42
+ direction?: CalendarDirectionType;
24
43
  /** Обработчик изменения выбранного периода. При isSingleDate = true возвращается только startDate */
25
44
  onChange?: (startDate: Date | null, endDate: Date | null) => void;
26
45
  }
@@ -1,11 +1,16 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
5
  import "core-js/modules/es.array.index-of.js";
5
6
  import "core-js/modules/es.symbol.js";
6
- import "core-js/modules/es.array.map.js";
7
7
  import "core-js/modules/es.date.to-string.js";
8
+ import "core-js/modules/es.array.reverse.js";
9
+ import "core-js/modules/es.array.from.js";
10
+ import "core-js/modules/es.string.iterator.js";
8
11
  import "core-js/modules/es.array.concat.js";
12
+ import "core-js/modules/es.array.map.js";
13
+ import "core-js/modules/es.object.values.js";
9
14
 
10
15
  var __rest = this && this.__rest || function (s, e) {
11
16
  var t = {};
@@ -23,6 +28,7 @@ var __rest = this && this.__rest || function (s, e) {
23
28
  import React, { useState, useEffect, useMemo, useRef } from 'react';
24
29
  import { START_DATE, END_DATE, useDatepicker, useMonth } from '@datepicker-react/hooks';
25
30
  import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
31
+ import { addMonths, subMonths } from 'date-fns';
26
32
  import differenceInDays from 'date-fns/differenceInDays';
27
33
  import format from 'date-fns/format';
28
34
  import isAfter from 'date-fns/isAfter';
@@ -42,6 +48,16 @@ var formatDate = function formatDate(date, pattern) {
42
48
  });
43
49
  };
44
50
 
51
+ export var CalendarTypes = {
52
+ CLASSIC: 'Classic',
53
+ MODERN: 'Modern'
54
+ };
55
+ export var CalendarDirectionTypes = {
56
+ PAST: 'past',
57
+ FUTURE: 'future',
58
+ BOTH: 'both'
59
+ };
60
+
45
61
  var weekdayLabelFormat = function weekdayLabelFormat(date) {
46
62
  return formatDate(date, 'EEEEEE');
47
63
  };
@@ -53,6 +69,45 @@ var dayLabelFormat = function dayLabelFormat(date) {
53
69
  var monthLabelFormat = function monthLabelFormat(date) {
54
70
  return formatDate(date, 'LLLL');
55
71
  };
72
+
73
+ var generateMonthsData = function generateMonthsData(pastMonthsCount, futureMonthsCount, direction) {
74
+ var months = [];
75
+ var currentDate = new Date();
76
+ var currentMonth = {
77
+ year: currentDate.getFullYear(),
78
+ month: currentDate.getMonth()
79
+ };
80
+
81
+ if (direction === 'past' || direction === 'both') {
82
+ var pastMonths = Array.from({
83
+ length: pastMonthsCount
84
+ }, function (_, i) {
85
+ var monthDate = subMonths(currentDate, i + 1);
86
+ return {
87
+ year: monthDate.getFullYear(),
88
+ month: monthDate.getMonth()
89
+ };
90
+ }).reverse();
91
+ months = [].concat(_toConsumableArray(pastMonths), [currentMonth]);
92
+ } else {
93
+ months.push(currentMonth);
94
+ }
95
+
96
+ if (direction === 'future' || direction === 'both') {
97
+ var futureMonths = Array.from({
98
+ length: futureMonthsCount
99
+ }, function (_, i) {
100
+ var monthDate = addMonths(currentDate, i + 1);
101
+ return {
102
+ year: monthDate.getFullYear(),
103
+ month: monthDate.getMonth()
104
+ };
105
+ });
106
+ months = [].concat(_toConsumableArray(months), _toConsumableArray(futureMonths));
107
+ }
108
+
109
+ return months;
110
+ };
56
111
  /* List of cases to check on component change:
57
112
 
58
113
  - Should correctly choose value and trigger callbacks with correct arguments on dates choose.
@@ -78,7 +133,15 @@ var Calendar = function Calendar(_ref) {
78
133
  className = _ref.className,
79
134
  onChange = _ref.onChange,
80
135
  minBookingDate = _ref.minBookingDate,
81
- maxBookingDate = _ref.maxBookingDate;
136
+ maxBookingDate = _ref.maxBookingDate,
137
+ _ref$type = _ref.type,
138
+ type = _ref$type === void 0 ? 'Classic' : _ref$type,
139
+ _ref$pastMonthsCount = _ref.pastMonthsCount,
140
+ pastMonthsCount = _ref$pastMonthsCount === void 0 ? 1 : _ref$pastMonthsCount,
141
+ _ref$futureMonthsCoun = _ref.futureMonthsCount,
142
+ futureMonthsCount = _ref$futureMonthsCoun === void 0 ? 1 : _ref$futureMonthsCoun,
143
+ _ref$direction = _ref.direction,
144
+ direction = _ref$direction === void 0 ? 'past' : _ref$direction;
82
145
  var calendarStateFromProps = useMemo(function () {
83
146
  var isInitialDatesEqual = startDate && endDate && isEqual(startDate, endDate);
84
147
  var isStartFocus = !startDate || endDate && !isInitialDatesEqual;
@@ -91,6 +154,9 @@ var Calendar = function Calendar(_ref) {
91
154
  focusedInput: isStartFocus ? START_DATE : END_DATE
92
155
  };
93
156
  }, [startDate, endDate, isSingleDate, minBookingDate, maxBookingDate]);
157
+ var monthsData = useMemo(function () {
158
+ return generateMonthsData(pastMonthsCount, futureMonthsCount, direction);
159
+ }, [pastMonthsCount, futureMonthsCount, direction]);
94
160
 
95
161
  var _useState = useState(calendarStateFromProps),
96
162
  _useState2 = _slicedToArray(_useState, 2),
@@ -103,9 +169,11 @@ var Calendar = function Calendar(_ref) {
103
169
  setHoveredDate = _useState4[1];
104
170
 
105
171
  var isUserChoice = useRef(false);
172
+ var currentMonthRef = useRef(null);
106
173
  var stateStartDate = calendarState.startDate,
107
174
  stateEndDate = calendarState.endDate,
108
175
  stateFocusedInput = calendarState.focusedInput;
176
+ var isModernType = type === CalendarTypes.MODERN;
109
177
 
110
178
  var _a = useDatepicker(_extends({
111
179
  onDatesChange: function onDatesChange() {
@@ -131,6 +199,19 @@ var Calendar = function Calendar(_ref) {
131
199
  setCalendarState(calendarStateFromProps);
132
200
  !isUserChoice.current && propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
133
201
  }, [calendarStateFromProps]);
202
+ useEffect(function () {
203
+ var _a, _b;
204
+
205
+ if (isModernType && direction !== 'future') {
206
+ var parentElement = (_a = currentMonthRef.current) === null || _a === void 0 ? void 0 : _a.parentNode;
207
+
208
+ if (parentElement && currentMonthRef.current) {
209
+ parentElement.scrollTo({
210
+ top: ((_b = currentMonthRef.current) === null || _b === void 0 ? void 0 : _b.scrollHeight) * pastMonthsCount || 0
211
+ });
212
+ }
213
+ }
214
+ }, [isModernType, direction, pastMonthsCount]);
134
215
 
135
216
  var getCalendarState = function getCalendarState(date) {
136
217
  var isStartChose = stateFocusedInput === START_DATE;
@@ -144,6 +225,26 @@ var Calendar = function Calendar(_ref) {
144
225
  var isClickBeforeStartDate = stateStartDate && isEndChose && !isAfter(date, stateStartDate || 0);
145
226
  var isStartDateChose = isStartDateClick || isEndDateClick || isClickBeforeChosenEndDate || isClickAfterChosenEndDate || isClickBeforeStartDate;
146
227
 
228
+ if (isModernType) {
229
+ var resetEndDateCondition = isStartChose || !stateStartDate || !!stateEndDate;
230
+
231
+ if (resetEndDateCondition || isEndChose && stateStartDate && isBefore(date, stateStartDate)) {
232
+ return {
233
+ startDate: date,
234
+ endDate: null,
235
+ focusedInput: END_DATE
236
+ };
237
+ }
238
+
239
+ if (isEndChose && stateStartDate) {
240
+ return {
241
+ startDate: stateStartDate,
242
+ endDate: date,
243
+ focusedInput: START_DATE
244
+ };
245
+ }
246
+ }
247
+
147
248
  switch (true) {
148
249
  case isSingleDate:
149
250
  return _extends(_extends({}, calendarState), {
@@ -230,7 +331,8 @@ var Calendar = function Calendar(_ref) {
230
331
  onDateSelect: handleDaySelect,
231
332
  onDateHover: handleDateHover,
232
333
  onMouseLeave: handleDateMouseLeave,
233
- isBetween: isDateHighlighted(date)
334
+ isBetween: isDateHighlighted(date),
335
+ isModern: isModernType
234
336
  }));
235
337
  }
236
338
 
@@ -242,7 +344,8 @@ var Calendar = function Calendar(_ref) {
242
344
  };
243
345
 
244
346
  var renderMonths = function renderMonths() {
245
- return activeMonths.map(function (_ref2) {
347
+ var monthsArray = isModernType ? monthsData : activeMonths;
348
+ return monthsArray.map(function (_ref2) {
246
349
  var month = _ref2.month,
247
350
  year = _ref2.year;
248
351
 
@@ -261,7 +364,10 @@ var Calendar = function Calendar(_ref) {
261
364
 
262
365
  var isPrevMonthDisabled = !!minBookingDate && isSameMonth(new Date(year, month, 1), minBookingDate);
263
366
  var isNextMonthDisabled = !!maxBookingDate && isSameMonth(new Date(year, month, 1), maxBookingDate);
264
- return /*#__PURE__*/React.createElement(Month, {
367
+ var isCurrentMonth = new Date().getFullYear() === year && new Date().getMonth() === month;
368
+ return /*#__PURE__*/React.createElement("div", {
369
+ ref: isCurrentMonth ? currentMonthRef : null
370
+ }, /*#__PURE__*/React.createElement(Month, {
265
371
  dataAttrs: {
266
372
  root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.month,
267
373
  arrowLeft: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowLeft,
@@ -271,16 +377,19 @@ var Calendar = function Calendar(_ref) {
271
377
  year: year,
272
378
  weekdayLabels: weekdayLabels,
273
379
  monthLabel: monthLabel,
274
- isPrevMonthDisabled: isPrevMonthDisabled,
275
- isNextMonthDisabled: isNextMonthDisabled,
380
+ isPrevMonthDisabled: isModernType || isPrevMonthDisabled,
381
+ isNextMonthDisabled: isModernType || isNextMonthDisabled,
276
382
  goToPreviousMonth: goToPreviousMonths,
277
- goToNextMonth: goToNextMonths
278
- }, renderDays(days));
383
+ goToNextMonth: goToNextMonths,
384
+ isModern: isModernType
385
+ }, renderDays(days)));
279
386
  });
280
387
  };
281
388
 
282
389
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
283
- className: cn([className])
390
+ className: cn([className], {
391
+ modern: isModernType
392
+ })
284
393
  }), renderMonths());
285
394
  };
286
395
 
@@ -298,6 +407,10 @@ Calendar.propTypes = {
298
407
  endDate: PropTypes.instanceOf(Date),
299
408
  minBookingDate: PropTypes.instanceOf(Date),
300
409
  maxBookingDate: PropTypes.instanceOf(Date),
410
+ type: PropTypes.oneOf(Object.values(CalendarTypes)),
411
+ pastMonthsCount: PropTypes.number,
412
+ futureMonthsCount: PropTypes.number,
413
+ direction: PropTypes.oneOf(Object.values(CalendarDirectionTypes)),
301
414
  onChange: PropTypes.func
302
415
  };
303
416
  export default Calendar;
@@ -28,7 +28,8 @@
28
28
  }
29
29
  .mfui-day:not(:disabled):not(.mfui-day_active):hover:after,
30
30
  .mfui-day:not(:disabled):not(.mfui-day_active):focus:after,
31
- .mfui-day_active:after {
31
+ .mfui-day_active:after,
32
+ .mfui-day_active-modern:after {
32
33
  content: '';
33
34
  position: absolute;
34
35
  top: 0;
@@ -40,12 +41,20 @@
40
41
  color: var(--content);
41
42
  background-color: var(--spbSky0);
42
43
  }
44
+ .mfui-day_active-modern:after {
45
+ width: 38px;
46
+ height: 38px;
47
+ }
48
+ .mfui-day_active-modern:hover:after {
49
+ background-color: var(--brandGreen) !important;
50
+ }
43
51
  .mfui-day:not(:disabled):not(.mfui-day_active):hover:after {
44
52
  color: var(--content);
45
53
  background-color: var(--spbSky0);
46
54
  }
47
55
  .mfui-day:not(:disabled):not(.mfui-day_active):focus:after,
48
- .mfui-day_active:after {
56
+ .mfui-day_active:after,
57
+ .mfui-day_active-modern:after {
49
58
  background-color: var(--brandGreen);
50
59
  }
51
60
  .mfui-day_disabled {
@@ -54,6 +63,7 @@
54
63
  pointer-events: none;
55
64
  }
56
65
  .mfui-day_active,
66
+ .mfui-day_active-modern,
57
67
  .mfui-day:not(:disabled):not(.mfui-day_active):focus {
58
68
  color: var(--stcWhite);
59
69
  }
@@ -126,3 +136,108 @@
126
136
  position: relative;
127
137
  z-index: 99;
128
138
  }
139
+ .mfui-day_modern {
140
+ width: 38.29px;
141
+ height: 38px;
142
+ }
143
+ .mfui-day_modern:not(:disabled):not(.mfui-day_modern_active-modern):hover:after,
144
+ .mfui-day_modern:not(:disabled):not(.mfui-day_modern_active-modern):focus:after,
145
+ .mfui-day_modern_active-modern:after {
146
+ content: '';
147
+ position: absolute;
148
+ top: 0;
149
+ left: 0;
150
+ z-index: 1;
151
+ width: 38px;
152
+ height: 38px;
153
+ border-radius: 50% !important;
154
+ color: var(--content);
155
+ background-color: var(--spbSky0);
156
+ }
157
+ .mfui-day_modern:not(:disabled):not(.mfui-day_modern_active-modern):hover:after {
158
+ color: var(--content);
159
+ background-color: var(--spbSky0);
160
+ }
161
+ .mfui-day_modern:not(:disabled):not(.mfui-day_modern_active-modern):focus:after,
162
+ .mfui-day_modern_active-modern:after {
163
+ background-color: var(--brandGreen);
164
+ }
165
+ .mfui-day_active-modern,
166
+ .mfui-day:not(:disabled):focus {
167
+ color: var(--stcWhite);
168
+ }
169
+ .mfui-day_active-modern + .mfui-day_active-modern:before,
170
+ .mfui-day_between-modern:hover + .mfui-day:not(.mfui-day_monday-modern).mfui-day_active-modern:before {
171
+ content: '';
172
+ position: absolute;
173
+ top: 0;
174
+ left: -22px;
175
+ z-index: -1;
176
+ display: block;
177
+ width: 40px;
178
+ height: 38px;
179
+ background-color: var(--spbSky1);
180
+ }
181
+ .mfui-day_between-modern {
182
+ position: relative;
183
+ border-radius: 0;
184
+ }
185
+ .mfui-day_between-modern:before {
186
+ content: '';
187
+ position: absolute;
188
+ top: 0;
189
+ left: -28px;
190
+ z-index: -1;
191
+ display: block;
192
+ height: 38px;
193
+ padding: 0 29px;
194
+ background-color: var(--spbSky1);
195
+ }
196
+ .mfui-day_between-modern:after {
197
+ content: '';
198
+ position: absolute;
199
+ top: 0;
200
+ right: -18px;
201
+ z-index: -1;
202
+ display: block;
203
+ width: 45px;
204
+ height: 38px;
205
+ background-color: var(--spbSky1);
206
+ }
207
+ .mfui-day_sunday-modern,
208
+ .mfui-day_last-modern {
209
+ border-radius: 50%;
210
+ }
211
+ .mfui-day_sunday-modern:before,
212
+ .mfui-day_last-modern:before {
213
+ padding-left: 20px;
214
+ }
215
+ .mfui-day_sunday-modern:after,
216
+ .mfui-day_last-modern:after {
217
+ right: 10px;
218
+ width: 38.29px;
219
+ border-radius: 50%;
220
+ }
221
+ .mfui-day_last-modern:after {
222
+ right: 0;
223
+ }
224
+ .mfui-day_monday-modern,
225
+ .mfui-day_first-modern {
226
+ border-radius: 50%;
227
+ }
228
+ .mfui-day_monday-modern:before,
229
+ .mfui-day_first-modern:before {
230
+ left: 0;
231
+ width: 38px;
232
+ padding: 0;
233
+ border-radius: 50%;
234
+ }
235
+ .mfui-day_sunday-modern.mfui-day_first-modern {
236
+ border-radius: 50%;
237
+ }
238
+ .mfui-day__label_modern {
239
+ font-weight: 400;
240
+ font-size: 15px;
241
+ line-height: 24px;
242
+ text-align: center;
243
+ }
@@ -18,6 +18,7 @@ export declare type DayType = {
18
18
  isBetween?: boolean;
19
19
  dayLabel?: string;
20
20
  date: Date;
21
+ isModern?: boolean;
21
22
  onMouseLeave?: () => void;
22
23
  };
23
24
  export declare type IDayProps = IDayPickerProps & DayType;
@@ -33,8 +33,10 @@ var Day = function Day(_a) {
33
33
  isBetween = _a$isBetween === void 0 ? false : _a$isBetween,
34
34
  dayLabel = _a.dayLabel,
35
35
  date = _a.date,
36
+ _a$isModern = _a.isModern,
37
+ isModern = _a$isModern === void 0 ? false : _a$isModern,
36
38
  onMouseLeave = _a.onMouseLeave,
37
- pickerProps = __rest(_a, ["dataAttrs", "isBetween", "dayLabel", "date", "onMouseLeave"]);
39
+ pickerProps = __rest(_a, ["dataAttrs", "isBetween", "dayLabel", "date", "isModern", "onMouseLeave"]);
38
40
 
39
41
  var dayRef = React.useRef(null);
40
42
 
@@ -50,15 +52,26 @@ var Day = function Day(_a) {
50
52
  onMouseEnter = _useDay.onMouseEnter,
51
53
  tabIndex = _useDay.tabIndex;
52
54
 
53
- var modClasses = {
54
- active: isSelectedStartOrEnd,
55
+ var modernClasses = {
56
+ modern: isModern,
55
57
  disabled: isDateDisabled,
58
+ 'active-modern': isSelectedStartOrEnd,
59
+ 'between-modern': isBetween || isSelected && !isSelectedStartOrEnd,
60
+ 'sunday-modern': isSunday(date),
61
+ 'monday-modern': isMonday(date),
62
+ 'first-modern': !isSelectedStartOrEnd && isFirstDayOfMonth(date),
63
+ 'last-modern': !isSelectedStartOrEnd && isLastDayOfMonth(date)
64
+ };
65
+ var classicClasses = {
66
+ active: isSelectedStartOrEnd,
56
67
  between: isBetween || isSelected && !isSelectedStartOrEnd,
57
68
  sunday: isSunday(date),
58
69
  monday: isMonday(date),
59
70
  first: !isSelectedStartOrEnd && isFirstDayOfMonth(date),
60
- last: !isSelectedStartOrEnd && isLastDayOfMonth(date)
71
+ last: !isSelectedStartOrEnd && isLastDayOfMonth(date),
72
+ disabled: isDateDisabled
61
73
  };
74
+ var modClasses = isModern ? modernClasses : classicClasses;
62
75
 
63
76
  var handleMouseLeave = function handleMouseLeave() {
64
77
  onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
@@ -74,7 +87,9 @@ var Day = function Day(_a) {
74
87
  ref: dayRef,
75
88
  className: cn(modClasses)
76
89
  }), /*#__PURE__*/React.createElement("span", {
77
- className: cn('label')
90
+ className: cn('label', {
91
+ modern: isModern
92
+ })
78
93
  }, dayLabel));
79
94
  };
80
95
 
@@ -85,6 +100,7 @@ Day.propTypes = {
85
100
  dayLabel: PropTypes.string,
86
101
  date: PropTypes.instanceOf(Date).isRequired,
87
102
  focusedDate: PropTypes.instanceOf(Date),
103
+ isModern: PropTypes.bool,
88
104
  isDateSelected: PropTypes.func.isRequired,
89
105
  isDateHovered: PropTypes.func.isRequired,
90
106
  isFirstOrLastSelectedDate: PropTypes.func.isRequired,
@@ -79,3 +79,57 @@ svg.mfui-month__arrow_disabled {
79
79
  cursor: default;
80
80
  opacity: 0.5;
81
81
  }
82
+ .mfui-month_modern {
83
+ width: 344px;
84
+ padding: 0 0 24px;
85
+ }
86
+ .mfui-month_modern .mfui-month__header {
87
+ display: -webkit-box;
88
+ display: -ms-flexbox;
89
+ display: flex;
90
+ -webkit-box-align: center;
91
+ -ms-flex-align: center;
92
+ align-items: center;
93
+ width: 328px;
94
+ margin-bottom: 16px;
95
+ text-transform: capitalize;
96
+ }
97
+ .mfui-month_modern .mfui-month__title {
98
+ font-size: 15px;
99
+ line-height: 24px;
100
+ font-weight: 500;
101
+ width: 224px;
102
+ margin: 0 auto;
103
+ text-align: center;
104
+ }
105
+ .mfui-month_modern .mfui-month__weekday-labels {
106
+ display: grid;
107
+ grid-template-columns: repeat(7, 1fr);
108
+ width: 328px;
109
+ padding-bottom: 0;
110
+ border-bottom: none;
111
+ -webkit-column-gap: 8px;
112
+ -moz-column-gap: 8px;
113
+ column-gap: 8px;
114
+ }
115
+ .mfui-month_modern .mfui-month__weekday {
116
+ width: 20px;
117
+ height: 24px;
118
+ margin: 0 auto;
119
+ color: var(--spbSky3);
120
+ font-weight: 400;
121
+ font-size: 15px;
122
+ line-height: 24px;
123
+ text-align: center;
124
+ text-transform: capitalize;
125
+ }
126
+ .mfui-month_modern .mfui-month__days {
127
+ display: grid;
128
+ grid-template-columns: repeat(7, 1fr);
129
+ width: 328px;
130
+ margin-top: 10px;
131
+ -webkit-column-gap: 0;
132
+ -moz-column-gap: 0;
133
+ column-gap: 0;
134
+ row-gap: 0;
135
+ }
@@ -20,6 +20,7 @@ export interface IMonthProps {
20
20
  weekdayLabels: string[];
21
21
  goToPreviousMonth: () => void;
22
22
  goToNextMonth: () => void;
23
+ isModern?: boolean;
23
24
  }
24
25
  declare const Month: React.FC<IMonthProps>;
25
26
  export default Month;