@skbkontur/react-ui 4.16.0 → 4.17.0-datepicker.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.
Files changed (174) hide show
  1. package/CHANGELOG.md +23 -149
  2. package/LICENSE +21 -21
  3. package/cjs/components/Calendar/Calendar.d.ts +62 -3
  4. package/cjs/components/Calendar/Calendar.js +122 -37
  5. package/cjs/components/Calendar/Calendar.js.map +1 -1
  6. package/cjs/components/Calendar/Calendar.md +112 -0
  7. package/cjs/components/Calendar/Calendar.styles.js +1 -1
  8. package/cjs/components/Calendar/Calendar.styles.js.map +1 -1
  9. package/cjs/components/Calendar/CalendarContext.d.ts +17 -0
  10. package/cjs/components/Calendar/CalendarContext.js +27 -0
  11. package/cjs/components/Calendar/CalendarContext.js.map +1 -0
  12. package/cjs/components/Calendar/CalendarDateShape.d.ts +2 -2
  13. package/cjs/components/Calendar/CalendarDateShape.js +1 -1
  14. package/cjs/components/Calendar/CalendarDateShape.js.map +1 -1
  15. package/cjs/components/Calendar/CalendarUtils.d.ts +9 -0
  16. package/cjs/components/Calendar/CalendarUtils.js +13 -3
  17. package/cjs/components/Calendar/CalendarUtils.js.map +1 -1
  18. package/cjs/components/Calendar/DayCellView.d.ts +27 -12
  19. package/cjs/components/Calendar/DayCellView.js +116 -25
  20. package/cjs/components/Calendar/DayCellView.js.map +1 -1
  21. package/cjs/components/Calendar/DayCellView.styles.d.ts +5 -0
  22. package/cjs/components/Calendar/DayCellView.styles.js +46 -12
  23. package/cjs/components/Calendar/DayCellView.styles.js.map +1 -1
  24. package/cjs/components/Calendar/Month.d.ts +1 -10
  25. package/cjs/components/Calendar/Month.js +15 -76
  26. package/cjs/components/Calendar/Month.js.map +1 -1
  27. package/cjs/components/Calendar/MonthView.d.ts +0 -3
  28. package/cjs/components/Calendar/MonthView.js +15 -6
  29. package/cjs/components/Calendar/MonthView.js.map +1 -1
  30. package/cjs/components/Calendar/MonthView.styles.js +1 -1
  31. package/cjs/components/Calendar/MonthView.styles.js.map +1 -1
  32. package/cjs/components/Calendar/MonthViewModel.js +4 -3
  33. package/cjs/components/Calendar/MonthViewModel.js.map +1 -1
  34. package/cjs/components/Calendar/config.js +6 -3
  35. package/cjs/components/Calendar/config.js.map +1 -1
  36. package/cjs/components/Calendar/index.d.ts +1 -0
  37. package/cjs/components/Calendar/index.js.map +1 -1
  38. package/cjs/components/DatePicker/DatePicker.d.ts +3 -1
  39. package/cjs/components/DatePicker/DatePicker.js +9 -2
  40. package/cjs/components/DatePicker/DatePicker.js.map +1 -1
  41. package/cjs/components/DatePicker/DatePicker.md +24 -1
  42. package/cjs/components/DatePicker/DatePickerHelpers.js +2 -1
  43. package/cjs/components/DatePicker/DatePickerHelpers.js.map +1 -1
  44. package/cjs/components/Gapped/Gapped.md +43 -43
  45. package/cjs/components/Hint/Hint.js +2 -1
  46. package/cjs/components/Hint/Hint.js.map +1 -1
  47. package/cjs/components/Kebab/Kebab.js +1 -1
  48. package/cjs/components/Kebab/Kebab.js.map +1 -1
  49. package/cjs/components/Paging/Paging.js +1 -1
  50. package/cjs/components/Paging/Paging.js.map +1 -1
  51. package/cjs/components/Paging/Paging.styles.js +2 -1
  52. package/cjs/components/Paging/Paging.styles.js.map +1 -1
  53. package/cjs/components/RadioGroup/RadioGroup.md +43 -43
  54. package/cjs/components/Token/Token.md +112 -112
  55. package/cjs/hooks/usePrevious.d.ts +1 -0
  56. package/cjs/hooks/usePrevious.js +9 -0
  57. package/cjs/hooks/usePrevious.js.map +1 -0
  58. package/cjs/internal/DateSelect/locale/locales/en.js +2 -1
  59. package/cjs/internal/DateSelect/locale/locales/en.js.map +1 -1
  60. package/cjs/internal/DateSelect/locale/locales/ru.js +2 -1
  61. package/cjs/internal/DateSelect/locale/locales/ru.js.map +1 -1
  62. package/cjs/internal/DateSelect/locale/types.d.ts +1 -0
  63. package/cjs/internal/NativeDateInput/utils.js +3 -2
  64. package/cjs/internal/NativeDateInput/utils.js.map +1 -1
  65. package/cjs/internal/ThemeShowcase/ThemeShowcase.md +13 -13
  66. package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
  67. package/cjs/internal/themes/DefaultTheme.d.ts +3 -0
  68. package/cjs/internal/themes/DefaultTheme.js +10 -3
  69. package/cjs/internal/themes/DefaultTheme.js.map +1 -1
  70. package/cjs/internal/themes/Theme2022.d.ts +4 -0
  71. package/cjs/internal/themes/Theme2022.js +11 -2
  72. package/cjs/internal/themes/Theme2022.js.map +1 -1
  73. package/cjs/internal/themes/Theme2022Dark.d.ts +5 -0
  74. package/cjs/internal/themes/Theme2022Dark.js +6 -1
  75. package/cjs/internal/themes/Theme2022Dark.js.map +1 -1
  76. package/cjs/lib/date/InternalDate.d.ts +2 -0
  77. package/cjs/lib/date/InternalDate.js +8 -1
  78. package/cjs/lib/date/InternalDate.js.map +1 -1
  79. package/cjs/lib/date/InternalDateTransformer.d.ts +2 -0
  80. package/cjs/lib/date/InternalDateTransformer.js +15 -0
  81. package/cjs/lib/date/InternalDateTransformer.js.map +1 -1
  82. package/cjs/lib/date/InternalDateValidator.js +2 -1
  83. package/cjs/lib/date/InternalDateValidator.js.map +1 -1
  84. package/cjs/lib/locale/constants.d.ts +3 -0
  85. package/cjs/lib/locale/constants.js +6 -2
  86. package/cjs/lib/locale/constants.js.map +1 -1
  87. package/components/Calendar/Calendar/Calendar.js +86 -65
  88. package/components/Calendar/Calendar/Calendar.js.map +1 -1
  89. package/components/Calendar/Calendar.d.ts +62 -3
  90. package/components/Calendar/Calendar.md +112 -0
  91. package/components/Calendar/Calendar.styles/Calendar.styles.js +1 -1
  92. package/components/Calendar/Calendar.styles/Calendar.styles.js.map +1 -1
  93. package/components/Calendar/CalendarContext/CalendarContext.js +13 -0
  94. package/components/Calendar/CalendarContext/CalendarContext.js.map +1 -0
  95. package/components/Calendar/CalendarContext/package.json +6 -0
  96. package/components/Calendar/CalendarContext.d.ts +17 -0
  97. package/components/Calendar/CalendarDateShape/CalendarDateShape.js +1 -1
  98. package/components/Calendar/CalendarDateShape/CalendarDateShape.js.map +1 -1
  99. package/components/Calendar/CalendarDateShape.d.ts +2 -2
  100. package/components/Calendar/CalendarUtils/CalendarUtils.js +7 -0
  101. package/components/Calendar/CalendarUtils/CalendarUtils.js.map +1 -1
  102. package/components/Calendar/CalendarUtils.d.ts +9 -0
  103. package/components/Calendar/DayCellView/DayCellView.js +95 -32
  104. package/components/Calendar/DayCellView/DayCellView.js.map +1 -1
  105. package/components/Calendar/DayCellView.d.ts +27 -12
  106. package/components/Calendar/DayCellView.styles/DayCellView.styles.js +22 -7
  107. package/components/Calendar/DayCellView.styles/DayCellView.styles.js.map +1 -1
  108. package/components/Calendar/DayCellView.styles.d.ts +5 -0
  109. package/components/Calendar/Month/Month.js +11 -77
  110. package/components/Calendar/Month/Month.js.map +1 -1
  111. package/components/Calendar/Month.d.ts +1 -10
  112. package/components/Calendar/MonthView/MonthView.js +17 -2
  113. package/components/Calendar/MonthView/MonthView.js.map +1 -1
  114. package/components/Calendar/MonthView.d.ts +0 -3
  115. package/components/Calendar/MonthView.styles/MonthView.styles.js +1 -1
  116. package/components/Calendar/MonthView.styles/MonthView.styles.js.map +1 -1
  117. package/components/Calendar/MonthViewModel/MonthViewModel.js +4 -3
  118. package/components/Calendar/MonthViewModel/MonthViewModel.js.map +1 -1
  119. package/components/Calendar/config/config.js +4 -3
  120. package/components/Calendar/config/config.js.map +1 -1
  121. package/components/Calendar/index/index.js +2 -1
  122. package/components/Calendar/index/index.js.map +1 -1
  123. package/components/Calendar/index.d.ts +1 -0
  124. package/components/DatePicker/DatePicker/DatePicker.js +7 -2
  125. package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
  126. package/components/DatePicker/DatePicker.d.ts +3 -1
  127. package/components/DatePicker/DatePicker.md +24 -1
  128. package/components/DatePicker/DatePickerHelpers/DatePickerHelpers.js +2 -1
  129. package/components/DatePicker/DatePickerHelpers/DatePickerHelpers.js.map +1 -1
  130. package/components/Gapped/Gapped.md +43 -43
  131. package/components/Hint/Hint/Hint.js +2 -1
  132. package/components/Hint/Hint/Hint.js.map +1 -1
  133. package/components/Kebab/Kebab/Kebab.js +1 -1
  134. package/components/Kebab/Kebab/Kebab.js.map +1 -1
  135. package/components/Paging/Paging/Paging.js +1 -1
  136. package/components/Paging/Paging/Paging.js.map +1 -1
  137. package/components/Paging/Paging.styles/Paging.styles.js +1 -1
  138. package/components/Paging/Paging.styles/Paging.styles.js.map +1 -1
  139. package/components/RadioGroup/RadioGroup.md +43 -43
  140. package/components/Token/Token.md +112 -112
  141. package/hooks/usePrevious/package.json +6 -0
  142. package/hooks/usePrevious/usePrevious.js +8 -0
  143. package/hooks/usePrevious/usePrevious.js.map +1 -0
  144. package/hooks/usePrevious.d.ts +1 -0
  145. package/internal/DateSelect/locale/locales/en/en.js +2 -1
  146. package/internal/DateSelect/locale/locales/en/en.js.map +1 -1
  147. package/internal/DateSelect/locale/locales/ru/ru.js +2 -1
  148. package/internal/DateSelect/locale/locales/ru/ru.js.map +1 -1
  149. package/internal/DateSelect/locale/types.d.ts +1 -0
  150. package/internal/NativeDateInput/utils/utils.js +2 -1
  151. package/internal/NativeDateInput/utils/utils.js.map +1 -1
  152. package/internal/ThemeShowcase/ThemeShowcase.md +13 -13
  153. package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
  154. package/internal/themes/DefaultTheme/DefaultTheme.js +13 -1
  155. package/internal/themes/DefaultTheme/DefaultTheme.js.map +1 -1
  156. package/internal/themes/DefaultTheme.d.ts +3 -0
  157. package/internal/themes/Theme2022/Theme2022.js +11 -3
  158. package/internal/themes/Theme2022/Theme2022.js.map +1 -1
  159. package/internal/themes/Theme2022.d.ts +4 -0
  160. package/internal/themes/Theme2022Dark/Theme2022Dark.js +9 -4
  161. package/internal/themes/Theme2022Dark/Theme2022Dark.js.map +1 -1
  162. package/internal/themes/Theme2022Dark.d.ts +5 -0
  163. package/lib/date/InternalDate/InternalDate.js +7 -1
  164. package/lib/date/InternalDate/InternalDate.js.map +1 -1
  165. package/lib/date/InternalDate.d.ts +2 -0
  166. package/lib/date/InternalDateTransformer/InternalDateTransformer.js +19 -0
  167. package/lib/date/InternalDateTransformer/InternalDateTransformer.js.map +1 -1
  168. package/lib/date/InternalDateTransformer.d.ts +2 -0
  169. package/lib/date/InternalDateValidator/InternalDateValidator.js +6 -1
  170. package/lib/date/InternalDateValidator/InternalDateValidator.js.map +1 -1
  171. package/lib/locale/constants/constants.js +4 -1
  172. package/lib/locale/constants/constants.js.map +1 -1
  173. package/lib/locale/constants.d.ts +3 -0
  174. package/package.json +2 -5
@@ -1,16 +1,20 @@
1
- "use strict";exports.__esModule = true;exports.DayCellView = DayCellView;var _react = _interopRequireWildcard(require("react"));
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.DayCellView = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _react = _interopRequireWildcard(require("react"));
2
2
 
3
3
  var _useLocaleForControl = require("../../lib/locale/useLocaleForControl");
4
-
5
4
  var _ThemeContext = require("../../lib/theming/ThemeContext");
6
5
  var _Emotion = require("../../lib/theming/Emotion");
7
6
  var _ThemeHelpers = require("../../lib/theming/ThemeHelpers");
8
7
  var _locale = require("../DatePicker/locale");
8
+ var _InternalDateTransformer = require("../../lib/date/InternalDateTransformer");
9
+ var _InternalDate = require("../../lib/date/InternalDate");
10
+ var _locale2 = require("../../lib/locale");
9
11
 
10
- var CDS = _interopRequireWildcard(require("./CalendarDateShape"));
11
12
  var _DayCellView = require("./DayCellView.styles");
12
- var _Calendar = require("./Calendar");function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
13
+ var _Calendar = require("./Calendar");
14
+ var _CalendarContext = require("./CalendarContext");
15
+ var CalendarUtils = _interopRequireWildcard(require("./CalendarUtils"));
13
16
 
17
+ var _CalendarDateShape = require("./CalendarDateShape");function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
14
18
 
15
19
 
16
20
 
@@ -21,42 +25,129 @@ var _Calendar = require("./Calendar");function _getRequireWildcardCache(nodeInte
21
25
 
22
26
 
23
27
 
24
- function DayCellView(props) {var _cx;
25
- var date = props.date,minDate = props.minDate,maxDate = props.maxDate,today = props.today,value = props.value,isWeekend = props.isWeekend,onDateClick = props.onDateClick;
26
- var theme = (0, _react.useContext)(_ThemeContext.ThemeContext);
27
- var _isTheme2022 = (0, _ThemeHelpers.isTheme2022)(theme);
28
28
 
29
- var handleClick = function handleClick() {
30
- var _props$date = props.date,date = _props$date.date,month = _props$date.month,year = _props$date.year;
31
- onDateClick == null ? void 0 : onDateClick({ date: date, month: month, year: year });
32
- };
33
29
 
34
- var child = _isTheme2022 ? /*#__PURE__*/
35
- _react.default.createElement("span", { className: (0, _Emotion.cx)(_DayCellView.globalClasses.todayCaption, _DayCellView.styles.todayCaption()) }, date.date) :
36
30
 
37
- date.date;
38
31
 
39
32
 
40
- var isToday = Boolean(today && CDS.isEqual(date, today));
41
33
 
34
+ var DayCellView = function DayCellView(props) {var _isHoliday;
35
+ var date = props.date;
36
+ var _useContext =
37
+ (0, _react.useContext)(_CalendarContext.CalendarContext),value = _useContext.value,hoveredDate = _useContext.hoveredDate,periodStartDate = _useContext.periodStartDate,periodEndDate = _useContext.periodEndDate,minDate = _useContext.minDate,maxDate = _useContext.maxDate,isHoliday = _useContext.isHoliday,renderDay = _useContext.renderDay,today = _useContext.today;
38
+ var _useContext2 = (0, _react.useContext)(_locale2.LocaleContext),langCode = _useContext2.langCode;
42
39
  var locale = (0, _useLocaleForControl.useLocaleForControl)('Calendar', _locale.DatePickerLocaleHelper);
43
40
 
41
+ var stringDate = _InternalDateTransformer.InternalDateTransformer.dateToInternalString({
42
+ date: date.date,
43
+ month: CalendarUtils.getMonthInHumanFormat(date.month),
44
+ year: date.year });
45
+
46
+
47
+ var isWeekend = (_isHoliday = isHoliday == null ? void 0 : isHoliday(stringDate, date.isWeekend)) != null ? _isHoliday : date.isWeekend;
48
+ var isSelected = Boolean((!periodStartDate || !periodEndDate) && value && (0, _CalendarDateShape.isEqual)(date, value));
49
+ var isHovered = (0, _CalendarDateShape.isEqual)(date, hoveredDate);
50
+ var isDisabled = !(0, _CalendarDateShape.isBetween)(date, minDate, maxDate);
51
+ var isToday = (0, _CalendarDateShape.isEqual)(today, date);
52
+
53
+ var isDayInSelectedPeriod = false,
54
+ isPeriodStart = false,
55
+ isPeriodEnd = false;
56
+
57
+ var periodStart = periodStartDate || hoveredDate;
58
+ var periodEnd = periodEndDate || hoveredDate;
59
+ if (periodStart && periodEnd) {
60
+ var _ref = (0, _CalendarDateShape.isLess)(periodStart, periodEnd) ?
61
+ [periodStart, periodEnd] :
62
+ [periodEnd, periodStart],earliestDate = _ref[0],latestDate = _ref[1];
63
+
64
+ isDayInSelectedPeriod = (0, _CalendarDateShape.isGreaterOrEqual)(date, earliestDate) && (0, _CalendarDateShape.isLessOrEqual)(date, latestDate);
65
+ isPeriodStart = (0, _CalendarDateShape.isEqual)(date, earliestDate);
66
+ isPeriodEnd = (0, _CalendarDateShape.isEqual)(date, latestDate);
67
+ }
68
+
69
+ var ariaLabel = locale.dayCellChooseDateAriaLabel + ": " + new _InternalDate.InternalDate({ langCode: langCode }).
70
+ setComponents((0, _extends2.default)({}, date), true).
71
+ toA11YFormat();
72
+
73
+ var defaultProps = {
74
+ ariaLabel: ariaLabel,
75
+ stringDate: stringDate,
76
+ isSelected: isSelected,
77
+ isHovered: isHovered,
78
+ isDisabled: isDisabled,
79
+ isToday: isToday,
80
+ isWeekend: isWeekend,
81
+ isDayInSelectedPeriod: isDayInSelectedPeriod,
82
+ isPeriodStart: isPeriodStart,
83
+ isPeriodEnd: isPeriodEnd,
84
+ children: date.date };
85
+
86
+
87
+ return renderDay ? renderDay(stringDate, defaultProps, Day) : /*#__PURE__*/_react.default.createElement(Day, defaultProps);
88
+ };exports.DayCellView = DayCellView;
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ var Day = function Day(_ref2)
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ {var _cx, _cx2;var ariaLabel = _ref2.ariaLabel,stringDate = _ref2.stringDate,children = _ref2.children,isSelected = _ref2.isSelected,isHovered = _ref2.isHovered,isDisabled = _ref2.isDisabled,isToday = _ref2.isToday,isWeekend = _ref2.isWeekend,isDayInSelectedPeriod = _ref2.isDayInSelectedPeriod,isPeriodStart = _ref2.isPeriodStart,isPeriodEnd = _ref2.isPeriodEnd;
116
+ var theme = (0, _react.useContext)(_ThemeContext.ThemeContext);
117
+ var _isTheme2022 = (0, _ThemeHelpers.isTheme2022)(theme);
118
+
119
+ var child = _isTheme2022 ? /*#__PURE__*/
120
+ _react.default.createElement("span", { className: (0, _Emotion.cx)(_DayCellView.globalClasses.todayCaption, _DayCellView.styles.todayCaption()) }, children) :
121
+
122
+ children;
123
+
124
+
44
125
  return /*#__PURE__*/(
45
126
  _react.default.createElement("button", {
46
127
  "data-tid": _Calendar.CalendarDataTids.dayCell,
47
128
  tabIndex: -1,
48
- "aria-label": locale.dayCellChooseDateAriaLabel + " " + (value == null ? void 0 : value.date) + "." + (value && value.month + 1) + "." + (value == null ? void 0 : value.year),
49
- disabled: !CDS.isBetween(date, minDate, maxDate),
129
+ "aria-label": ariaLabel,
130
+ "data-date": stringDate,
131
+ disabled: isDisabled,
50
132
  className: (0, _Emotion.cx)((_cx = {}, _cx[
51
133
  _DayCellView.styles.cell(theme)] = true, _cx[
52
- _DayCellView.styles.today(theme)] = isToday && !_isTheme2022, _cx[
53
- _DayCellView.styles.today2022(theme)] = isToday && _isTheme2022, _cx[
54
- _DayCellView.styles.selected(theme)] = Boolean(value && CDS.isEqual(date, value)), _cx[
55
- _DayCellView.styles.weekend(theme)] = Boolean(isWeekend), _cx)),
134
+ _DayCellView.styles.weekend(theme)] = isWeekend, _cx[
135
+ _DayCellView.styles.period(theme)] = isDayInSelectedPeriod, _cx[
136
+ _DayCellView.styles.periodStart()] = isPeriodStart, _cx[
137
+ _DayCellView.styles.periodEnd()] = isPeriodEnd, _cx)) }, /*#__PURE__*/
138
+
139
+
140
+ _react.default.createElement("div", {
141
+ className: (0, _Emotion.cx)((_cx2 = {}, _cx2[
142
+ _DayCellView.styles.element(theme)] = true, _cx2[
143
+ _DayCellView.styles.today(theme)] = isToday && !_isTheme2022, _cx2[
144
+ _DayCellView.styles.today2022(theme)] = isToday && _isTheme2022, _cx2[
145
+ _DayCellView.styles.selected(theme)] = isSelected, _cx2[
146
+ _DayCellView.styles.elementHover(theme)] = isHovered, _cx2)) },
147
+
56
148
 
57
- onClick: handleClick },
149
+ child)));
58
150
 
59
- child));
60
151
 
61
152
 
62
- }
153
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["DayCellView.tsx"],"names":["DayCellView","props","date","minDate","maxDate","today","value","isWeekend","onDateClick","theme","ThemeContext","_isTheme2022","handleClick","month","year","child","globalClasses","todayCaption","styles","isToday","Boolean","CDS","isEqual","locale","DatePickerLocaleHelper","CalendarDataTids","dayCell","dayCellChooseDateAriaLabel","isBetween","cell","today2022","selected","weekend"],"mappings":"yEAAA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,sC;;;;;;;;;;;;AAYO,SAASA,WAAT,CAAqBC,KAArB,EAA8C;AACnD,MAAQC,IAAR,GAAyED,KAAzE,CAAQC,IAAR,CAAcC,OAAd,GAAyEF,KAAzE,CAAcE,OAAd,CAAuBC,OAAvB,GAAyEH,KAAzE,CAAuBG,OAAvB,CAAgCC,KAAhC,GAAyEJ,KAAzE,CAAgCI,KAAhC,CAAuCC,KAAvC,GAAyEL,KAAzE,CAAuCK,KAAvC,CAA8CC,SAA9C,GAAyEN,KAAzE,CAA8CM,SAA9C,CAAyDC,WAAzD,GAAyEP,KAAzE,CAAyDO,WAAzD;AACA,MAAMC,KAAK,GAAG,uBAAWC,0BAAX,CAAd;AACA,MAAMC,YAAY,GAAG,+BAAYF,KAAZ,CAArB;;AAEA,MAAMG,WAAW,GAAG,SAAdA,WAAc,GAAM;AACxB,sBAA8BX,KAAK,CAACC,IAApC,CAAQA,IAAR,eAAQA,IA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CAACd,KAAK,IAAIe,GAAG,CAACC,OAAJ,CAAYpB,IAAZ,EAAkBI,KAAlB,CAAV,CAJxB;AAKRY,0BAAOc,OAAP,CAAevB,KAAf,CALQ,IAKgBW,OAAO,CAACb,SAAD,CALvB,OALb;;AAYE,MAAA,OAAO,EAAEK,WAZX;;AAcGG,IAAAA,KAdH,CADF;;;AAkBD","sourcesContent":["import React, { useContext } from 'react';\n\nimport { useLocaleForControl } from '../../lib/locale/useLocaleForControl';\nimport { Nullable } from '../../typings/utility-types';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { cx } from '../../lib/theming/Emotion';\nimport { isTheme2022 } from '../../lib/theming/ThemeHelpers';\nimport { DatePickerLocaleHelper } from '../DatePicker/locale';\n\nimport * as CDS from './CalendarDateShape';\nimport { globalClasses, styles } from './DayCellView.styles';\nimport { CalendarDataTids } from './Calendar';\n\ninterface DayCellViewProps {\n date: CDS.CalendarDateShape;\n today?: CDS.CalendarDateShape;\n value?: Nullable<CDS.CalendarDateShape>;\n minDate?: CDS.CalendarDateShape;\n maxDate?: CDS.CalendarDateShape;\n onDateClick?: (day: CDS.CalendarDateShape) => void;\n isWeekend?: boolean;\n}\n\nexport function DayCellView(props: DayCellViewProps) {\n const { date, minDate, maxDate, today, value, isWeekend, onDateClick } = props;\n const theme = useContext(ThemeContext);\n const _isTheme2022 = isTheme2022(theme);\n\n const handleClick = () => {\n const { date, month, year } = props.date;\n onDateClick?.({ date, month, year });\n };\n\n const child = _isTheme2022 ? (\n <span className={cx(globalClasses.todayCaption, styles.todayCaption())}>{date.date}</span>\n ) : (\n date.date\n );\n\n const isToday = Boolean(today && CDS.isEqual(date, today));\n\n const locale = useLocaleForControl('Calendar', DatePickerLocaleHelper);\n\n return (\n <button\n data-tid={CalendarDataTids.dayCell}\n tabIndex={-1}\n aria-label={`${locale.dayCellChooseDateAriaLabel} ${value?.date}.${value && value.month + 1}.${value?.year}`}\n disabled={!CDS.isBetween(date, minDate, maxDate)}\n className={cx({\n [styles.cell(theme)]: true,\n [styles.today(theme)]: isToday && !_isTheme2022,\n [styles.today2022(theme)]: isToday && _isTheme2022,\n [styles.selected(theme)]: Boolean(value && CDS.isEqual(date, value)),\n [styles.weekend(theme)]: Boolean(isWeekend),\n })}\n onClick={handleClick}\n >\n {child}\n </button>\n );\n}\n"]}
1
+ {"version":3,"sources":["DayCellView.tsx"],"names":["DayCellView","props","date","CalendarContext","value","hoveredDate","periodStartDate","periodEndDate","minDate","maxDate","isHoliday","renderDay","today","LocaleContext","langCode","locale","DatePickerLocaleHelper","stringDate","InternalDateTransformer","dateToInternalString","month","CalendarUtils","getMonthInHumanFormat","year","isWeekend","isSelected","Boolean","isHovered","isDisabled","isToday","isDayInSelectedPeriod","isPeriodStart","isPeriodEnd","periodStart","periodEnd","earliestDate","latestDate","ariaLabel","dayCellChooseDateAriaLabel","InternalDate","setComponents","toA11YFormat","defaultProps","children","Day","theme","ThemeContext","_isTheme2022","child","globalClasses","todayCaption","styles","CalendarDataTids","dayCell","cell","weekend","period","element","today2022","selected","elementHover"],"mappings":"2OAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wD;;;;;;;;;;;;;;;;;AAiBO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD,EAA6B;AACtD,MAAQC,IAAR,GAAiBD,KAAjB,CAAQC,IAAR;AACA;AACE,yBAAWC,gCAAX,CADF,CAAQC,KAAR,eAAQA,KAAR,CAAeC,WAAf,eAAeA,WAAf,CAA4BC,eAA5B,eAA4BA,eAA5B,CAA6CC,aAA7C,eAA6CA,aAA7C,CAA4DC,OAA5D,eAA4DA,OAA5D,CAAqEC,OAArE,eAAqEA,OAArE,CAA8EC,SAA9E,eAA8EA,SAA9E,CAAyFC,SAAzF,eAAyFA,SAAzF,CAAoGC,KAApG,eAAoGA,KAApG;AAEA,qBAAqB,uBAAWC,sBAAX,CAArB,CAAQC,QAAR,gBAAQA,QAAR;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useContext } from 'react';\n\nimport { useLocaleForControl } from '../../lib/locale/useLocaleForControl';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { cx } from '../../lib/theming/Emotion';\nimport { isTheme2022 } from '../../lib/theming/ThemeHelpers';\nimport { DatePickerLocaleHelper } from '../DatePicker/locale';\nimport { InternalDateTransformer } from '../../lib/date/InternalDateTransformer';\nimport { InternalDate } from '../../lib/date/InternalDate';\nimport { LocaleContext } from '../../lib/locale';\n\nimport { globalClasses, styles } from './DayCellView.styles';\nimport { CalendarDataTids } from './Calendar';\nimport { CalendarContext } from './CalendarContext';\nimport * as CalendarUtils from './CalendarUtils';\nimport { DayCellViewModel } from './DayCellViewModel';\nimport { isBetween, isEqual, isGreaterOrEqual, isLess, isLessOrEqual } from './CalendarDateShape';\n\nexport interface DayCellViewProps {\n date: DayCellViewModel;\n}\n\nexport interface DayCellViewFlags {\n isSelected: boolean;\n isHovered: boolean;\n isDisabled: boolean;\n isToday: boolean;\n isWeekend: boolean;\n isDayInSelectedPeriod: boolean;\n isPeriodStart: boolean;\n isPeriodEnd: boolean;\n}\n\nexport const DayCellView = (props: DayCellViewProps) => {\n const { date } = props;\n const { value, hoveredDate, periodStartDate, periodEndDate, minDate, maxDate, isHoliday, renderDay, today } =\n useContext(CalendarContext);\n const { langCode } = useContext(LocaleContext);\n const locale = useLocaleForControl('Calendar', DatePickerLocaleHelper);\n\n const stringDate = InternalDateTransformer.dateToInternalString({\n date: date.date,\n month: CalendarUtils.getMonthInHumanFormat(date.month),\n year: date.year,\n });\n\n const isWeekend = isHoliday?.(stringDate, date.isWeekend) ?? date.isWeekend;\n const isSelected = Boolean((!periodStartDate || !periodEndDate) && value && isEqual(date, value));\n const isHovered = isEqual(date, hoveredDate);\n const isDisabled = !isBetween(date, minDate, maxDate);\n const isToday = isEqual(today, date);\n\n let isDayInSelectedPeriod = false,\n isPeriodStart = false,\n isPeriodEnd = false;\n\n const periodStart = periodStartDate || hoveredDate;\n const periodEnd = periodEndDate || hoveredDate;\n if (periodStart && periodEnd) {\n const [earliestDate, latestDate] = isLess(periodStart, periodEnd)\n ? [periodStart, periodEnd]\n : [periodEnd, periodStart];\n\n isDayInSelectedPeriod = isGreaterOrEqual(date, earliestDate) && isLessOrEqual(date, latestDate);\n isPeriodStart = isEqual(date, earliestDate);\n isPeriodEnd = isEqual(date, latestDate);\n }\n\n const ariaLabel = `${locale.dayCellChooseDateAriaLabel}: ${new InternalDate({ langCode })\n .setComponents({ ...date }, true)\n .toA11YFormat()}`;\n\n const defaultProps: Required<DayProps> = {\n ariaLabel,\n stringDate,\n isSelected,\n isHovered,\n isDisabled,\n isToday,\n isWeekend,\n isDayInSelectedPeriod,\n isPeriodStart,\n isPeriodEnd,\n children: date.date,\n };\n\n return renderDay ? (renderDay(stringDate, defaultProps, Day) as JSX.Element) : <Day {...defaultProps} />;\n};\n\nexport type DayProps = PropsWithChildren<{\n ariaLabel: string;\n stringDate: string;\n isSelected: boolean;\n isHovered: boolean;\n isDisabled: boolean;\n isToday: boolean;\n isWeekend: boolean;\n isDayInSelectedPeriod: boolean;\n isPeriodStart: boolean;\n isPeriodEnd: boolean;\n}>;\n\nconst Day: FunctionComponent<DayProps> = ({\n ariaLabel,\n stringDate,\n children,\n isSelected,\n isHovered,\n isDisabled,\n isToday,\n isWeekend,\n isDayInSelectedPeriod,\n isPeriodStart,\n isPeriodEnd,\n}) => {\n const theme = useContext(ThemeContext);\n const _isTheme2022 = isTheme2022(theme);\n\n const child = _isTheme2022 ? (\n <span className={cx(globalClasses.todayCaption, styles.todayCaption())}>{children}</span>\n ) : (\n children\n );\n\n return (\n <button\n data-tid={CalendarDataTids.dayCell}\n tabIndex={-1}\n aria-label={ariaLabel}\n data-date={stringDate}\n disabled={isDisabled}\n className={cx({\n [styles.cell(theme)]: true,\n [styles.weekend(theme)]: isWeekend,\n [styles.period(theme)]: isDayInSelectedPeriod,\n [styles.periodStart()]: isPeriodStart,\n [styles.periodEnd()]: isPeriodEnd,\n })}\n >\n <div\n className={cx({\n [styles.element(theme)]: true,\n [styles.today(theme)]: isToday && !_isTheme2022,\n [styles.today2022(theme)]: isToday && _isTheme2022,\n [styles.selected(theme)]: isSelected,\n [styles.elementHover(theme)]: isHovered,\n })}\n >\n {child}\n </div>\n </button>\n );\n};\n"]}
@@ -4,7 +4,12 @@ export declare const globalClasses: {
4
4
  };
5
5
  export declare const styles: {
6
6
  cell(t: Theme): string;
7
+ element(t: Theme): string;
8
+ elementHover(t: Theme): string;
7
9
  selected(t: Theme): string;
10
+ period(t: Theme): string;
11
+ periodStart(): string;
12
+ periodEnd(): string;
8
13
  weekend(t: Theme): string;
9
14
  today(t: Theme): string;
10
15
  today2022(t: Theme): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.styles = exports.globalClasses = void 0;var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _Emotion = require("../../lib/theming/Emotion");
2
2
 
3
- var _Mixins = require("../../lib/styles/Mixins");var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
3
+ var _Mixins = require("../../lib/styles/Mixins");var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
4
4
 
5
5
  var globalClasses = (0, _Emotion.prefix)('day-cell-view')({
6
6
  todayCaption: 'today-caption' });exports.globalClasses = globalClasses;
@@ -8,7 +8,7 @@ var globalClasses = (0, _Emotion.prefix)('day-cell-view')({
8
8
 
9
9
  var styles = (0, _Emotion.memoizeStyle)({
10
10
  cell: function cell(t) {
11
- return (0, _Emotion.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n ", ";\n\n background: ", ";\n border: 1px solid transparent;\n display: inline-block;\n font-size: 14px;\n padding: 0;\n text-align: center;\n user-select: none;\n position: relative;\n\n width: ", ";\n height: ", ";\n line-height: ", ";\n border-radius: 50%;\n\n &:hover {\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n }\n &:disabled {\n opacity: 0.5;\n pointer-events: none;\n }\n &:active:hover:enabled {\n color: ", ";\n }\n "])),
11
+ return (0, _Emotion.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)(["\n ", ";\n\n background: ", ";\n display: inline-block;\n font-size: 14px;\n padding: 0;\n text-align: center;\n user-select: none;\n position: relative;\n cursor: pointer;\n\n width: ", ";\n height: ", ";\n line-height: ", ";\n\n &:disabled {\n opacity: 0.5;\n pointer-events: none;\n }\n\n > * {\n pointer-events: none;\n }\n "])),
12
12
  (0, _Mixins.resetButton)(),
13
13
 
14
14
  t.calendarCellBg,
@@ -20,47 +20,81 @@ var styles = (0, _Emotion.memoizeStyle)({
20
20
 
21
21
 
22
22
 
23
- t.calendarCellSize,
24
- t.calendarCellSize,
25
- t.calendarCellLineHeight,
23
+ t.calendarCellWidth,
24
+ t.calendarCellHeight,
25
+ t.calendarCellLineHeight);
26
+
27
+
26
28
 
27
29
 
28
30
 
29
- t.calendarCellHoverBgColor,
30
- t.calendarCellHoverColor,
31
31
 
32
32
 
33
33
 
34
34
 
35
35
 
36
+ },
37
+
38
+ element: function element(t) {
39
+ return (0, _Emotion.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n border-radius: ", ";\n border: 1px solid transparent;\n\n &:active:hover:enabled {\n color: ", ";\n }\n "])),
40
+ t.calendarCellBorderRadius,
41
+
36
42
 
37
43
 
38
44
  t.calendarCellActiveHoverColor);
39
45
 
40
46
 
47
+ },
48
+
49
+ elementHover: function elementHover(t) {
50
+ return (0, _Emotion.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)(["\n background-color: ", ";\n color: ", ";\n cursor: pointer;\n "])),
51
+ t.calendarCellHoverBgColor,
52
+ t.calendarCellHoverColor);
53
+
54
+
41
55
  },
42
56
 
43
57
  selected: function selected(t) {
44
- return (0, _Emotion.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)(["\n background-color: ", ";\n color: ", ";\n "])),
58
+ return (0, _Emotion.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)(["\n background-color: ", ";\n color: ", ";\n "])),
45
59
  t.calendarCellSelectedBgColor,
46
60
  t.calendarCellSelectedFontColor);
47
61
 
62
+ },
63
+
64
+ period: function period(t) {
65
+ return (0, _Emotion.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n background-color: ", ";\n "])),
66
+ t.calendarCellSelectedBgColor);
67
+
68
+ },
69
+
70
+ periodStart: function periodStart() {
71
+ return (0, _Emotion.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteralLoose2.default)(["\n border-top-left-radius: 50%;\n border-bottom-left-radius: 50%;\n "])));
72
+
73
+
74
+
75
+ },
76
+
77
+ periodEnd: function periodEnd() {
78
+ return (0, _Emotion.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteralLoose2.default)(["\n border-top-right-radius: 50%;\n border-bottom-right-radius: 50%;\n "])));
79
+
80
+
81
+
48
82
  },
49
83
 
50
84
  weekend: function weekend(t) {
51
- return (0, _Emotion.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteralLoose2.default)(["\n color: ", ";\n "])),
85
+ return (0, _Emotion.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteralLoose2.default)(["\n color: ", ";\n "])),
52
86
  t.calendarCellWeekendColor);
53
87
 
54
88
  },
55
89
 
56
90
  today: function today(t) {
57
- return (0, _Emotion.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteralLoose2.default)(["\n border: ", ";\n "])),
91
+ return (0, _Emotion.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteralLoose2.default)(["\n border: ", ";\n "])),
58
92
  t.calendarCellTodayBorder);
59
93
 
60
94
  },
61
95
 
62
96
  today2022: function today2022(t) {
63
- return (0, _Emotion.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n .", " {\n border-bottom: ", ";\n }\n "])),
97
+ return (0, _Emotion.css)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteralLoose2.default)(["\n .", " {\n border-bottom: ", ";\n }\n "])),
64
98
  globalClasses.todayCaption,
65
99
  t.calendarCellTodayBorder);
66
100
 
@@ -68,7 +102,7 @@ var styles = (0, _Emotion.memoizeStyle)({
68
102
  },
69
103
 
70
104
  todayCaption: function todayCaption() {
71
- return (0, _Emotion.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteralLoose2.default)(["\n padding-bottom: 2px;\n "])));
105
+ return (0, _Emotion.css)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteralLoose2.default)(["\n padding-bottom: 2px;\n "])));
72
106
 
73
107
 
74
108
  } });exports.styles = styles;
@@ -1 +1 @@
1
- {"version":3,"sources":["DayCellView.styles.ts"],"names":["globalClasses","todayCaption","styles","cell","t","css","calendarCellBg","calendarCellSize","calendarCellLineHeight","calendarCellHoverBgColor","calendarCellHoverColor","calendarCellActiveHoverColor","selected","calendarCellSelectedBgColor","calendarCellSelectedFontColor","weekend","calendarCellWeekendColor","today","calendarCellTodayBorder","today2022"],"mappings":"oSAAA;;AAEA,iD;;AAEO,IAAMA,aAAa,GAAG,qBAAO,eAAP,EAAwB;AACnDC,EAAAA,YAAY,EAAE,eADqC,EAAxB,CAAtB,C;;;AAIA,IAAMC,MAAM,GAAG,2BAAa;AACjCC,EAAAA,IADiC,gBAC5BC,CAD4B,EAClB;AACb,eAAOC,YAAP;AACI,8BADJ;;AAGgBD,IAAAA,CAAC,CAACE,cAHlB;;;;;;;;;AAYWF,IAAAA,CAAC,CAACG,gBAZb;AAaYH,IAAAA,CAAC,CAACG,gBAbd;AAciBH,IAAAA,CAAC,CAACI,sBAdnB;;;;AAkBwBJ,IAAAA,CAAC,CAACK,wBAlB1B;AAmBaL,IAAAA,CAAC,CAACM,sBAnBf;;;;;;;;AA2BaN,IAAAA,CAAC,CAACO,4BA3Bf;;;AA8BD,GAhCgC;;AAkCjCC,EAAAA,QAlCiC,oBAkCxBR,CAlCwB,EAkCd;AACjB,eAAOC,YAAP;AACsBD,IAAAA,CAAC,CAACS,2BADxB;AAEWT,IAAAA,CAAC,CAACU,6BAFb;;AAID,GAvCgC;;AAyCjCC,EAAAA,OAzCiC,mBAyCzBX,CAzCyB,EAyCf;AAChB,eAAOC,YAAP;AACWD,IAAAA,CAAC,CAACY,wBADb;;AAGD,GA7CgC;;AA+CjCC,EAAAA,KA/CiC,iBA+C3Bb,CA/C2B,EA+CjB;AACd,eAAOC,YAAP;AACYD,IAAAA,CAAC,CAACc,uBADd;;AAGD,GAnDgC;;AAqDjCC,EAAAA,SArDiC,qBAqDvBf,CArDuB,EAqDb;AAClB,eAAOC,YAAP;AACKL,IAAAA,aAAa,CAACC,YADnB;AAEqBG,IAAAA,CAAC,CAACc,uBAFvB;;;AAKD,GA3DgC;;AA6DjCjB,EAAAA,YA7DiC,0BA6DlB;AACb,eAAOI,YAAP;;;AAGD,GAjEgC,EAAb,CAAf,C","sourcesContent":["import { css, memoizeStyle, prefix } from '../../lib/theming/Emotion';\nimport { Theme } from '../../lib/theming/Theme';\nimport { resetButton } from '../../lib/styles/Mixins';\n\nexport const globalClasses = prefix('day-cell-view')({\n todayCaption: 'today-caption',\n});\n\nexport const styles = memoizeStyle({\n cell(t: Theme) {\n return css`\n ${resetButton()};\n\n background: ${t.calendarCellBg};\n border: 1px solid transparent;\n display: inline-block;\n font-size: 14px;\n padding: 0;\n text-align: center;\n user-select: none;\n position: relative;\n\n width: ${t.calendarCellSize};\n height: ${t.calendarCellSize};\n line-height: ${t.calendarCellLineHeight};\n border-radius: 50%;\n\n &:hover {\n background-color: ${t.calendarCellHoverBgColor};\n color: ${t.calendarCellHoverColor};\n cursor: pointer;\n }\n &:disabled {\n opacity: 0.5;\n pointer-events: none;\n }\n &:active:hover:enabled {\n color: ${t.calendarCellActiveHoverColor};\n }\n `;\n },\n\n selected(t: Theme) {\n return css`\n background-color: ${t.calendarCellSelectedBgColor};\n color: ${t.calendarCellSelectedFontColor};\n `;\n },\n\n weekend(t: Theme) {\n return css`\n color: ${t.calendarCellWeekendColor};\n `;\n },\n\n today(t: Theme) {\n return css`\n border: ${t.calendarCellTodayBorder};\n `;\n },\n\n today2022(t: Theme) {\n return css`\n .${globalClasses.todayCaption} {\n border-bottom: ${t.calendarCellTodayBorder};\n }\n `;\n },\n\n todayCaption() {\n return css`\n padding-bottom: 2px;\n `;\n },\n});\n"]}
1
+ {"version":3,"sources":["DayCellView.styles.ts"],"names":["globalClasses","todayCaption","styles","cell","t","css","calendarCellBg","calendarCellWidth","calendarCellHeight","calendarCellLineHeight","element","calendarCellBorderRadius","calendarCellActiveHoverColor","elementHover","calendarCellHoverBgColor","calendarCellHoverColor","selected","calendarCellSelectedBgColor","calendarCellSelectedFontColor","period","periodStart","periodEnd","weekend","calendarCellWeekendColor","today","calendarCellTodayBorder","today2022"],"mappings":"oSAAA;;AAEA,iD;;AAEO,IAAMA,aAAa,GAAG,qBAAO,eAAP,EAAwB;AACnDC,EAAAA,YAAY,EAAE,eADqC,EAAxB,CAAtB,C;;;AAIA,IAAMC,MAAM,GAAG,2BAAa;AACjCC,EAAAA,IADiC,gBAC5BC,CAD4B,EAClB;AACb,eAAOC,YAAP;AACI,8BADJ;;AAGgBD,IAAAA,CAAC,CAACE,cAHlB;;;;;;;;;AAYWF,IAAAA,CAAC,CAACG,iBAZb;AAaYH,IAAAA,CAAC,CAACI,kBAbd;AAciBJ,IAAAA,CAAC,CAACK,sBAdnB;;;;;;;;;;;AAyBD,GA3BgC;;AA6BjCC,EAAAA,OA7BiC,mBA6BzBN,CA7ByB,EA6Bf;AAChB,eAAOC,YAAP;AACmBD,IAAAA,CAAC,CAACO,wBADrB;;;;AAKaP,IAAAA,CAAC,CAACQ,4BALf;;;AAQD,GAtCgC;;AAwCjCC,EAAAA,YAxCiC,wBAwCpBT,CAxCoB,EAwCV;AACrB,eAAOC,YAAP;AACsBD,IAAAA,CAAC,CAACU,wBADxB;AAEWV,IAAAA,CAAC,CAACW,sBAFb;;;AAKD,GA9CgC;;AAgDjCC,EAAAA,QAhDiC,oBAgDxBZ,CAhDwB,EAgDd;AACjB,eAAOC,YAAP;AACsBD,IAAAA,CAAC,CAACa,2BADxB;AAEWb,IAAAA,CAAC,CAACc,6BAFb;;AAID,GArDgC;;AAuDjCC,EAAAA,MAvDiC,kBAuD1Bf,CAvD0B,EAuDhB;AACf,eAAOC,YAAP;AACsBD,IAAAA,CAAC,CAACa,2BADxB;;AAGD,GA3DgC;;AA6DjCG,EAAAA,WA7DiC,yBA6DnB;AACZ,eAAOf,YAAP;;;;AAID,GAlEgC;;AAoEjCgB,EAAAA,SApEiC,uBAoErB;AACV,eAAOhB,YAAP;;;;AAID,GAzEgC;;AA2EjCiB,EAAAA,OA3EiC,mBA2EzBlB,CA3EyB,EA2Ef;AAChB,eAAOC,YAAP;AACWD,IAAAA,CAAC,CAACmB,wBADb;;AAGD,GA/EgC;;AAiFjCC,EAAAA,KAjFiC,iBAiF3BpB,CAjF2B,EAiFjB;AACd,eAAOC,YAAP;AACYD,IAAAA,CAAC,CAACqB,uBADd;;AAGD,GArFgC;;AAuFjCC,EAAAA,SAvFiC,qBAuFvBtB,CAvFuB,EAuFb;AAClB,eAAOC,YAAP;AACKL,IAAAA,aAAa,CAACC,YADnB;AAEqBG,IAAAA,CAAC,CAACqB,uBAFvB;;;AAKD,GA7FgC;;AA+FjCxB,EAAAA,YA/FiC,0BA+FlB;AACb,eAAOI,YAAP;;;AAGD,GAnGgC,EAAb,CAAf,C","sourcesContent":["import { css, memoizeStyle, prefix } from '../../lib/theming/Emotion';\nimport { Theme } from '../../lib/theming/Theme';\nimport { resetButton } from '../../lib/styles/Mixins';\n\nexport const globalClasses = prefix('day-cell-view')({\n todayCaption: 'today-caption',\n});\n\nexport const styles = memoizeStyle({\n cell(t: Theme) {\n return css`\n ${resetButton()};\n\n background: ${t.calendarCellBg};\n display: inline-block;\n font-size: 14px;\n padding: 0;\n text-align: center;\n user-select: none;\n position: relative;\n cursor: pointer;\n\n width: ${t.calendarCellWidth};\n height: ${t.calendarCellHeight};\n line-height: ${t.calendarCellLineHeight};\n\n &:disabled {\n opacity: 0.5;\n pointer-events: none;\n }\n\n > * {\n pointer-events: none;\n }\n `;\n },\n\n element(t: Theme) {\n return css`\n border-radius: ${t.calendarCellBorderRadius};\n border: 1px solid transparent;\n\n &:active:hover:enabled {\n color: ${t.calendarCellActiveHoverColor};\n }\n `;\n },\n\n elementHover(t: Theme) {\n return css`\n background-color: ${t.calendarCellHoverBgColor};\n color: ${t.calendarCellHoverColor};\n cursor: pointer;\n `;\n },\n\n selected(t: Theme) {\n return css`\n background-color: ${t.calendarCellSelectedBgColor};\n color: ${t.calendarCellSelectedFontColor};\n `;\n },\n\n period(t: Theme) {\n return css`\n background-color: ${t.calendarCellSelectedBgColor};\n `;\n },\n\n periodStart() {\n return css`\n border-top-left-radius: 50%;\n border-bottom-left-radius: 50%;\n `;\n },\n\n periodEnd() {\n return css`\n border-top-right-radius: 50%;\n border-bottom-right-radius: 50%;\n `;\n },\n\n weekend(t: Theme) {\n return css`\n color: ${t.calendarCellWeekendColor};\n `;\n },\n\n today(t: Theme) {\n return css`\n border: ${t.calendarCellTodayBorder};\n `;\n },\n\n today2022(t: Theme) {\n return css`\n .${globalClasses.todayCaption} {\n border-bottom: ${t.calendarCellTodayBorder};\n }\n `;\n },\n\n todayCaption() {\n return css`\n padding-bottom: 2px;\n `;\n },\n});\n"]}
@@ -1,24 +1,15 @@
1
1
  import React from 'react';
2
- import { Nullable } from '../../typings/utility-types';
3
- import * as CDS from './CalendarDateShape';
4
2
  import { MonthViewModel } from './MonthViewModel';
5
3
  interface MonthProps {
6
4
  top: number;
7
5
  month: MonthViewModel;
8
- maxDate?: CDS.CalendarDateShape;
9
- minDate?: CDS.CalendarDateShape;
10
- today?: CDS.CalendarDateShape;
11
- value?: Nullable<CDS.CalendarDateShape>;
12
- onDateClick?: (date: CDS.CalendarDateShape) => void;
13
6
  onMonthYearChange: (month: number, year: number) => void;
14
- isHoliday?: (day: CDS.CalendarDateShape & {
15
- isWeekend: boolean;
16
- }) => boolean;
17
7
  }
18
8
  export declare class Month extends React.Component<MonthProps> {
19
9
  private theme;
20
10
  private monthSelect;
21
11
  private yearSelect;
12
+ constructor(props: MonthProps);
22
13
  shouldComponentUpdate(nextProps: MonthProps): boolean;
23
14
  componentDidMount(): void;
24
15
  render(): JSX.Element;
@@ -4,10 +4,7 @@ var _ThemeContext = require("../../lib/theming/ThemeContext");
4
4
 
5
5
 
6
6
 
7
- var _createPropsGetter = require("../../lib/createPropsGetter");
8
-
9
7
  var _config = require("./config");
10
- var CDS = _interopRequireWildcard(require("./CalendarDateShape"));
11
8
 
12
9
 
13
10
  var _MonthView = require("./MonthView");
@@ -21,40 +18,14 @@ var _MonthView2 = require("./MonthView.styles");function _getRequireWildcardCach
21
18
 
22
19
 
23
20
 
21
+ Month = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(Month, _React$Component);
24
22
 
25
23
 
26
24
 
27
25
 
28
26
 
29
-
30
-
31
-
32
- Month = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(Month, _React$Component);function Month() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
33
-
34
-
35
- monthSelect = null;_this.
36
- yearSelect = null;_this.
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
27
+ function Month(props) {var _this;
28
+ _this = _React$Component.call(this, props) || this;_this.monthSelect = null;_this.yearSelect = null;_this.
58
29
 
59
30
 
60
31
 
@@ -130,42 +101,23 @@ Month = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(M
130
101
 
131
102
  handleYearSelect = function (year) {
132
103
  _this.props.onMonthYearChange(_this.props.month.month, year);
133
- };return _this;}var _proto = Month.prototype;_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {if (this.props.top !== nextProps.top) {return true;}if (!CDS.isEqual(nextProps.value, this.props.value)) {return true;}if (!CDS.isEqual(nextProps.today, this.props.today)) {return true;}if (!CDS.isEqual(nextProps.minDate, this.props.minDate)) {return true;}if (!CDS.isEqual(nextProps.maxDate, this.props.maxDate)) {return true;}return this.props.month !== nextProps.month;};_proto.componentDidMount = function componentDidMount() {CalendarScrollEvents.addListener(this.closeSelects);};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _this$props = this.props,month = _this$props.month,maxDate = _this$props.maxDate,minDate = _this$props.minDate,top = _this$props.top;return /*#__PURE__*/_react.default.createElement(_MonthView.MonthView, { firstDayOffset: month.offset, height: month.getHeight(this.theme), isFirstInYear: month.isFirstInYear, isLastInYear: month.isLastInYear, maxDate: maxDate, minDate: minDate, month: month.month, top: top, year: month.year, onMonthSelect: this.handleMonthSelect, onYearSelect: this.handleYearSelect, monthSelectRef: this.monthRef, yearSelectRef: this.yearRef }, this.renderCells());};_proto.renderCells = function renderCells() {return /*#__PURE__*/_react.default.createElement(MonthDayGrid, { days: this.props.month.days, offset: this.props.month.offset, minDate: this.props.minDate, maxDate: this.props.maxDate, today: this.props.today, value: this.props.value, onDateClick: this.props.onDateClick, isHoliday: this.props.isHoliday });};return Month;}(_react.default.Component);exports.Month = Month;var
134
-
135
-
136
-
104
+ };_this.state = {};return _this;}var _proto = Month.prototype;_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {// console.log('Month shouldComponentUpdate', nextProps);
105
+ if (this.props.top !== nextProps.top) {return true;}return this.props.month !== nextProps.month;};_proto.componentDidMount = function componentDidMount() {CalendarScrollEvents.addListener(this.closeSelects);};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _this$props = this.props,month = _this$props.month,top = _this$props.top;return /*#__PURE__*/_react.default.createElement(_MonthView.MonthView, { firstDayOffset: month.offset, height: month.getHeight(this.theme), isFirstInYear: month.isFirstInYear, isLastInYear: month.isLastInYear, month: month.month, top: top, year: month.year, onMonthSelect: this.handleMonthSelect, onYearSelect: this.handleYearSelect, monthSelectRef: this.monthRef, yearSelectRef: this.yearRef }, this.renderCells());};_proto.renderCells = function renderCells() {return /*#__PURE__*/_react.default.createElement(MonthDayGrid, { days: this.props.month.days, offset: this.props.month.offset });};return Month;}(_react.default.Component);exports.Month = Month;var
137
106
 
138
107
 
139
108
 
140
109
 
141
110
 
142
111
 
112
+ MonthDayGrid = /*#__PURE__*/function (_React$Component2) {(0, _inheritsLoose2.default)(MonthDayGrid, _React$Component2);
143
113
 
144
114
 
145
-
146
-
147
- MonthDayGrid = /*#__PURE__*/function (_React$Component2) {(0, _inheritsLoose2.default)(MonthDayGrid, _React$Component2);function MonthDayGrid() {var _this3;for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}_this3 = _React$Component2.call.apply(_React$Component2, [this].concat(args)) || this;_this3.
148
-
149
-
150
-
151
-
152
-
153
-
154
- getProps = (0, _createPropsGetter.createPropsGetter)(MonthDayGrid.defaultProps);return _this3;}var _proto2 = MonthDayGrid.prototype;_proto2.
115
+ function MonthDayGrid(props) {var _this3;
116
+ _this3 = _React$Component2.call(this, props) || this;
117
+ _this3.state = {};return _this3;
118
+ }var _proto2 = MonthDayGrid.prototype;_proto2.
155
119
 
156
120
  shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
157
- if (!CDS.isEqual(nextProps.value, this.props.value)) {
158
- return true;
159
- }
160
- if (!CDS.isEqual(nextProps.today, this.props.today)) {
161
- return true;
162
- }
163
- if (!CDS.isEqual(nextProps.minDate, this.props.minDate)) {
164
- return true;
165
- }
166
- if (!CDS.isEqual(nextProps.maxDate, this.props.maxDate)) {
167
- return true;
168
- }
169
121
  return this.props.days !== nextProps.days;
170
122
  };_proto2.
171
123
 
@@ -180,31 +132,18 @@ MonthDayGrid = /*#__PURE__*/function (_React$Component2) {(0, _inheritsLoose2.de
180
132
 
181
133
  };_proto2.
182
134
 
183
- renderMain = function renderMain() {var _this5 = this;
135
+ renderMain = function renderMain() {
184
136
  return /*#__PURE__*/(
185
137
  _react.default.createElement("div", { className: _MonthView2.styles.monthDayGrid(this.theme) }, /*#__PURE__*/
186
138
  _react.default.createElement("div", {
187
139
  style: {
188
- width: this.props.offset * (0, _config.themeConfig)(this.theme).DAY_SIZE,
140
+ width: this.props.offset * (0, _config.themeConfig)(this.theme).DAY_WIDTH,
189
141
  display: 'inline-block' } }),
190
142
 
191
143
 
192
- this.props.days.map(function (day) {
193
- var isWeekend = _this5.getProps().isHoliday(day);
194
-
195
- return /*#__PURE__*/(
196
- _react.default.createElement(_DayCellView.DayCellView, {
197
- date: day,
198
- key: day.date + "." + day.month + "." + day.year,
199
- minDate: _this5.props.minDate,
200
- maxDate: _this5.props.maxDate,
201
- today: _this5.props.today,
202
- value: _this5.props.value,
203
- isWeekend: isWeekend,
204
- onDateClick: _this5.props.onDateClick }));
205
-
144
+ this.props.days.map(function (day) {return /*#__PURE__*/(
145
+ _react.default.createElement(_DayCellView.DayCellView, { date: day, key: day.date + "." + day.month + "." + day.year }));})));
206
146
 
207
- })));
208
147
 
209
148
 
210
- };return MonthDayGrid;}(_react.default.Component);MonthDayGrid.defaultProps = { isHoliday: function isHoliday(day) {return day.isWeekend;} };
149
+ };return MonthDayGrid;}(_react.default.Component);
@@ -1 +1 @@
1
- {"version":3,"sources":["Month.tsx"],"names":["Month","monthSelect","yearSelect","closeSelects","close","monthRef","yearRef","handleMonthSelect","month","props","onMonthYearChange","year","handleYearSelect","shouldComponentUpdate","nextProps","top","CDS","isEqual","value","today","minDate","maxDate","componentDidMount","CalendarScrollEvents","addListener","render","theme","renderMain","offset","getHeight","isFirstInYear","isLastInYear","renderCells","days","onDateClick","isHoliday","React","Component","MonthDayGrid","getProps","defaultProps","styles","monthDayGrid","width","DAY_SIZE","display","map","day","isWeekend","date"],"mappings":"iPAAA;;AAEA;;;;AAIA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA,gD;;;;;;;;;;;;;;;;AAgBaA,K;;;AAGHC,IAAAA,W,GAAiC,I;AACjCC,IAAAA,U,GAAgC,I;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EhCC,IAAAA,Y,GAAe,YAAM;AAC3B,UAAI,MAAKF,WAAT,EAAsB;AACpB,cAAKA,WAAL,CAAiBG,KAAjB;AACD;AACD,UAAI,MAAKF,UAAT,EAAqB;AACnB,cAAKA,UAAL,CAAgBE,KAAhB;AACD;AACF,K;;AAEOC,IAAAA,Q,GAAW,UAACJ,WAAD,EAAoC;AACrD,YAAKA,WAAL,GAAmBA,WAAnB;AACD,K;;AAEOK,IAAAA,O,GAAU,UAACJ,UAAD,EAAmC;AACnD,YAAKA,UAAL,GAAkBA,UAAlB;AACD,K;;AAEOK,IAAAA,iB,GAAoB,UAACC,KAAD,EAAmB;AAC7C,YAAKC,KAAL,CAAWC,iBAAX,CAA6BF,KAA7B,EAAoC,MAAKC,KAAL,CAAWD,KAAX,CAAiBG,IAArD;AACD,K;;AAEOC,IAAAA,gB,GAAmB,UAACD,IAAD,EAAkB;AAC3C,YAAKF,KAAL,CAAWC,iBAAX,CAA6B,MAAKD,KAAL,CAAWD,KAAX,CAAiBA,KAA9C,EAAqDG,IAArD;AACD,K,mDA/FME,qB,GAAP,+BAA6BC,SAA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ACpC,IAFvC;AAGE,YAAA,OAAO,EAAE,MAAI,CAACF,KAAL,CAAWW,OAHtB;AAIE,YAAA,OAAO,EAAE,MAAI,CAACX,KAAL,CAAWY,OAJtB;AAKE,YAAA,KAAK,EAAE,MAAI,CAACZ,KAAL,CAAWU,KALpB;AAME,YAAA,KAAK,EAAE,MAAI,CAACV,KAAL,CAAWS,KANpB;AAOE,YAAA,SAAS,EAAE8B,SAPb;AAQE,YAAA,WAAW,EAAE,MAAI,CAACvC,KAAL,CAAWyB,WAR1B,GADF;;;AAYD,OAfA,CAPH,CADF;;;AA0BD,G,uBA/DwBE,eAAMC,S,EAA3BC,Y,CAGUE,Y,GAA6B,EACzCL,SAAS,EAAE,mBAACY,GAAD,UAAyDA,GAAG,CAACC,SAA7D,EAD8B,E","sourcesContent":["import React from 'react';\n\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { DateSelect } from '../../internal/DateSelect';\nimport { Nullable } from '../../typings/utility-types';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { themeConfig } from './config';\nimport * as CDS from './CalendarDateShape';\nimport { MonthViewModel } from './MonthViewModel';\nimport { DayCellViewModel } from './DayCellViewModel';\nimport { MonthView } from './MonthView';\nimport { DayCellView } from './DayCellView';\nimport * as CalendarScrollEvents from './CalendarScrollEvents';\nimport { styles } from './MonthView.styles';\n\ninterface MonthProps {\n top: number;\n month: MonthViewModel;\n maxDate?: CDS.CalendarDateShape;\n minDate?: CDS.CalendarDateShape;\n today?: CDS.CalendarDateShape;\n value?: Nullable<CDS.CalendarDateShape>;\n onDateClick?: (date: CDS.CalendarDateShape) => void;\n onMonthYearChange: (month: number, year: number) => void;\n isHoliday?: (day: CDS.CalendarDateShape & { isWeekend: boolean }) => boolean;\n}\n\ntype DefaultProps = Required<Pick<MonthDayGridProps, 'isHoliday'>>;\n\nexport class Month extends React.Component<MonthProps> {\n private theme!: Theme;\n\n private monthSelect: DateSelect | null = null;\n private yearSelect: DateSelect | null = null;\n\n public shouldComponentUpdate(nextProps: MonthProps) {\n if (this.props.top !== nextProps.top) {\n return true;\n }\n if (!CDS.isEqual(nextProps.value, this.props.value)) {\n return true;\n }\n if (!CDS.isEqual(nextProps.today, this.props.today)) {\n return true;\n }\n if (!CDS.isEqual(nextProps.minDate, this.props.minDate)) {\n return true;\n }\n if (!CDS.isEqual(nextProps.maxDate, this.props.maxDate)) {\n return true;\n }\n return this.props.month !== nextProps.month;\n }\n\n public componentDidMount() {\n CalendarScrollEvents.addListener(this.closeSelects);\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderMain() {\n const { month, maxDate, minDate, top } = this.props;\n return (\n <MonthView\n firstDayOffset={month.offset}\n height={month.getHeight(this.theme)}\n isFirstInYear={month.isFirstInYear}\n isLastInYear={month.isLastInYear}\n maxDate={maxDate}\n minDate={minDate}\n month={month.month}\n top={top}\n year={month.year}\n onMonthSelect={this.handleMonthSelect}\n onYearSelect={this.handleYearSelect}\n monthSelectRef={this.monthRef}\n yearSelectRef={this.yearRef}\n >\n {this.renderCells()}\n </MonthView>\n );\n }\n\n private renderCells() {\n return (\n <MonthDayGrid\n days={this.props.month.days}\n offset={this.props.month.offset}\n minDate={this.props.minDate}\n maxDate={this.props.maxDate}\n today={this.props.today}\n value={this.props.value}\n onDateClick={this.props.onDateClick}\n isHoliday={this.props.isHoliday}\n />\n );\n }\n\n private closeSelects = () => {\n if (this.monthSelect) {\n this.monthSelect.close();\n }\n if (this.yearSelect) {\n this.yearSelect.close();\n }\n };\n\n private monthRef = (monthSelect: DateSelect | null) => {\n this.monthSelect = monthSelect;\n };\n\n private yearRef = (yearSelect: DateSelect | null) => {\n this.yearSelect = yearSelect;\n };\n\n private handleMonthSelect = (month: number) => {\n this.props.onMonthYearChange(month, this.props.month.year);\n };\n\n private handleYearSelect = (year: number) => {\n this.props.onMonthYearChange(this.props.month.month, year);\n };\n}\n\ninterface MonthDayGridProps {\n days: DayCellViewModel[];\n offset: number;\n minDate?: CDS.CalendarDateShape;\n maxDate?: CDS.CalendarDateShape;\n today?: CDS.CalendarDateShape;\n value?: Nullable<CDS.CalendarDateShape>;\n onDateClick?: (x0: CDS.CalendarDateShape) => void;\n isHoliday?: (day: CDS.CalendarDateShape & { isWeekend: boolean }) => boolean;\n}\n\nclass MonthDayGrid extends React.Component<MonthDayGridProps> {\n private theme!: Theme;\n\n public static defaultProps: DefaultProps = {\n isHoliday: (day: CDS.CalendarDateShape & { isWeekend: boolean }) => day.isWeekend,\n };\n\n private getProps = createPropsGetter(MonthDayGrid.defaultProps);\n\n public shouldComponentUpdate(nextProps: MonthDayGridProps) {\n if (!CDS.isEqual(nextProps.value, this.props.value)) {\n return true;\n }\n if (!CDS.isEqual(nextProps.today, this.props.today)) {\n return true;\n }\n if (!CDS.isEqual(nextProps.minDate, this.props.minDate)) {\n return true;\n }\n if (!CDS.isEqual(nextProps.maxDate, this.props.maxDate)) {\n return true;\n }\n return this.props.days !== nextProps.days;\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderMain() {\n return (\n <div className={styles.monthDayGrid(this.theme)}>\n <div\n style={{\n width: this.props.offset * themeConfig(this.theme).DAY_SIZE,\n display: 'inline-block',\n }}\n />\n {this.props.days.map((day) => {\n const isWeekend = this.getProps().isHoliday(day);\n\n return (\n <DayCellView\n date={day}\n key={`${day.date}.${day.month}.${day.year}`}\n minDate={this.props.minDate}\n maxDate={this.props.maxDate}\n today={this.props.today}\n value={this.props.value}\n isWeekend={isWeekend}\n onDateClick={this.props.onDateClick}\n />\n );\n })}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["Month.tsx"],"names":["Month","props","monthSelect","yearSelect","closeSelects","close","monthRef","yearRef","handleMonthSelect","month","onMonthYearChange","year","handleYearSelect","state","shouldComponentUpdate","nextProps","top","componentDidMount","CalendarScrollEvents","addListener","render","theme","renderMain","offset","getHeight","isFirstInYear","isLastInYear","renderCells","days","React","Component","MonthDayGrid","styles","monthDayGrid","width","DAY_WIDTH","display","map","day","date"],"mappings":"iPAAA;;AAEA;;;;AAIA;;;AAGA;AACA;AACA;AACA,gD;;;;;;;;AAQaA,K;;;;;;AAMX,iBAAYC,KAAZ,EAA+B;AAC7B,wCAAMA,KAAN,UAD6B,MAHvBC,WAGuB,GAHU,IAGV,OAFvBC,UAEuB,GAFS,IAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDvBC,IAAAA,YAtDuB,GAsDR,YAAM;AAC3B,UAAI,MAAKF,WAAT,EAAsB;AACpB,cAAKA,WAAL,CAAiBG,KAAjB;AACD;AACD,UAAI,MAAKF,UAAT,EAAqB;AACnB,cAAKA,UAAL,CAAgBE,KAAhB;AACD;AACF,KA7D8B;;AA+DvBC,IAAAA,QA/DuB,GA+DZ,UAACJ,WAAD,EAAoC;AACrD,YAAKA,WAAL,GAAmBA,WAAnB;AACD,KAjE8B;;AAmEvBK,IAAAA,OAnEuB,GAmEb,UAACJ,UAAD,EAAmC;AACnD,YAAKA,UAAL,GAAkBA,UAAlB;AACD,KArE8B;;AAuEvBK,IAAAA,iBAvEuB,GAuEH,UAACC,KAAD,EAAmB;AAC7C,YAAKR,KAAL,CAAWS,iBAAX,CAA6BD,KAA7B,EAAoC,MAAKR,KAAL,CAAWQ,KAAX,CAAiBE,IAArD;AACD,KAzE8B;;AA2EvBC,IAAAA,gBA3EuB,GA2EJ,UAACD,IAAD,EAAkB;AAC3C,YAAKV,KAAL,CAAWS,iBAAX,CAA6B,MAAKT,KAAL,CAAWQ,KAAX,CAAiBA,KAA9C,EAAqDE,IAArD;AACD,KA7E8B,CAE7B,MAAKE,KAAL,GAAa,EAAb,CAF6B,aAG9B,C,oCAEMC,qB,GAAP,+BAA6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1DwBM,eAAMC,S;;;;;;;AA2F3BC,Y;;;AAGJ,wBAAY9B,KAAZ,EAAsC;AACpC,0CAAMA,KAAN;AACA,WAAKY,KAAL,GAAa,EAAb,CAFoC;AAGrC,G;;AAEMC,EAAAA,qB,GAAP,+BAA6BC,SAA7B,EAA2D;AACzD,WAAO,KAAKd,KAAL,CAAW2B,IAAX,KAAoBb,SAAS,CAACa,IAArC;AACD,G;;AAEMR,EAAAA,M,GAAP,kBAAgB;AACd;AACE,mCAAC,0BAAD,CAAc,QAAd;AACG,gBAACC,KAAD,EAAW;AACV,QAAA,MAAI,CAACA,KAAL,GAAaA,KAAb;AACA,eAAO,MAAI,CAACC,UAAL,EAAP;AACD,OAJH,CADF;;;AAQD,G;;AAEMA,EAAAA,U,GAAP,sBAAoB;AAClB;AACE,4CAAK,SAAS,EAAEU,mBAAOC,YAAP,CAAoB,KAAKZ,KAAzB,CAAhB;AACE;AACE,QAAA,KAAK,EAAE;AACLa,UAAAA,KAAK,EAAE,KAAKjC,KAAL,CAAWsB,MAAX,GAAoB,yBAAY,KAAKF,KAAjB,EAAwBc,SAD9C;AAELC,UAAAA,OAAO,EAAE,cAFJ,EADT,GADF;;;AAOG,WAAKnC,KAAL,CAAW2B,IAAX,CAAgBS,GAAhB,CAAoB,UAACC,GAAD;AACnB,uCAAC,wBAAD,IAAa,IAAI,EAAEA,GAAnB,EAAwB,GAAG,EAAKA,GAAG,CAACC,IAAT,SAAiBD,GAAG,CAAC7B,KAArB,SAA8B6B,GAAG,CAAC3B,IAA7D,GADmB,GAApB,CAPH,CADF;;;;AAaD,G,uBArCwBkB,eAAMC,S","sourcesContent":["import React from 'react';\n\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { DateSelect } from '../../internal/DateSelect';\n\nimport { themeConfig } from './config';\nimport { MonthViewModel } from './MonthViewModel';\nimport { DayCellViewModel } from './DayCellViewModel';\nimport { MonthView } from './MonthView';\nimport { DayCellView } from './DayCellView';\nimport * as CalendarScrollEvents from './CalendarScrollEvents';\nimport { styles } from './MonthView.styles';\n\ninterface MonthProps {\n top: number;\n month: MonthViewModel;\n onMonthYearChange: (month: number, year: number) => void;\n}\n\nexport class Month extends React.Component<MonthProps> {\n private theme!: Theme;\n\n private monthSelect: DateSelect | null = null;\n private yearSelect: DateSelect | null = null;\n\n constructor(props: MonthProps) {\n super(props);\n this.state = {};\n }\n\n public shouldComponentUpdate(nextProps: MonthProps) {\n // console.log('Month shouldComponentUpdate', nextProps);\n if (this.props.top !== nextProps.top) {\n return true;\n }\n\n return this.props.month !== nextProps.month;\n }\n\n public componentDidMount() {\n CalendarScrollEvents.addListener(this.closeSelects);\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderMain() {\n const { month, top } = this.props;\n return (\n <MonthView\n firstDayOffset={month.offset}\n height={month.getHeight(this.theme)}\n isFirstInYear={month.isFirstInYear}\n isLastInYear={month.isLastInYear}\n month={month.month}\n top={top}\n year={month.year}\n onMonthSelect={this.handleMonthSelect}\n onYearSelect={this.handleYearSelect}\n monthSelectRef={this.monthRef}\n yearSelectRef={this.yearRef}\n >\n {this.renderCells()}\n </MonthView>\n );\n }\n\n private renderCells() {\n return <MonthDayGrid days={this.props.month.days} offset={this.props.month.offset} />;\n }\n\n private closeSelects = () => {\n if (this.monthSelect) {\n this.monthSelect.close();\n }\n if (this.yearSelect) {\n this.yearSelect.close();\n }\n };\n\n private monthRef = (monthSelect: DateSelect | null) => {\n this.monthSelect = monthSelect;\n };\n\n private yearRef = (yearSelect: DateSelect | null) => {\n this.yearSelect = yearSelect;\n };\n\n private handleMonthSelect = (month: number) => {\n this.props.onMonthYearChange(month, this.props.month.year);\n };\n\n private handleYearSelect = (year: number) => {\n this.props.onMonthYearChange(this.props.month.month, year);\n };\n}\n\ninterface MonthDayGridProps {\n days: DayCellViewModel[];\n offset: number;\n}\n\nclass MonthDayGrid extends React.Component<MonthDayGridProps> {\n private theme!: Theme;\n\n constructor(props: MonthDayGridProps) {\n super(props);\n this.state = {};\n }\n\n public shouldComponentUpdate(nextProps: MonthDayGridProps) {\n return this.props.days !== nextProps.days;\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderMain() {\n return (\n <div className={styles.monthDayGrid(this.theme)}>\n <div\n style={{\n width: this.props.offset * themeConfig(this.theme).DAY_WIDTH,\n display: 'inline-block',\n }}\n />\n {this.props.days.map((day) => (\n <DayCellView date={day} key={`${day.date}.${day.month}.${day.year}`} />\n ))}\n </div>\n );\n }\n}\n"]}
@@ -1,14 +1,11 @@
1
1
  import React from 'react';
2
2
  import { DateSelect } from '../../internal/DateSelect';
3
- import * as CDS from './CalendarDateShape';
4
3
  interface MonthViewProps {
5
4
  children: React.ReactNode;
6
5
  firstDayOffset: number;
7
6
  height: number;
8
7
  isFirstInYear?: boolean;
9
8
  isLastInYear?: boolean;
10
- maxDate?: CDS.CalendarDateShape;
11
- minDate?: CDS.CalendarDateShape;
12
9
  month: number;
13
10
  top: number;
14
11
  year: number;