@chayns-components/date 5.0.0-beta.577 → 5.0.0-beta.582
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/lib/cjs/components/calendar/Calendar.js +140 -0
- package/lib/cjs/components/calendar/Calendar.js.map +1 -0
- package/lib/cjs/components/calendar/Calendar.styles.js +20 -0
- package/lib/cjs/components/calendar/Calendar.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js +153 -0
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js +21 -0
- package/lib/cjs/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/Month.js +42 -0
- package/lib/cjs/components/calendar/month-wrapper/month/Month.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/Month.styles.js +23 -0
- package/lib/cjs/components/calendar/month-wrapper/month/Month.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +59 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js +17 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.js +66 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +60 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +17 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +18 -0
- package/lib/cjs/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +44 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js +16 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +15 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +16 -0
- package/lib/cjs/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -0
- package/lib/cjs/components/date-info/DateInfo.js +109 -0
- package/lib/cjs/components/date-info/DateInfo.js.map +1 -0
- package/lib/cjs/components/opening-times/OpeningTimes.js +212 -0
- package/lib/cjs/components/opening-times/OpeningTimes.js.map +1 -0
- package/lib/cjs/components/opening-times/OpeningTimes.styles.js +28 -0
- package/lib/cjs/components/opening-times/OpeningTimes.styles.js.map +1 -0
- package/lib/cjs/components/opening-times/hint-text/HintText.js +19 -0
- package/lib/cjs/components/opening-times/hint-text/HintText.js.map +1 -0
- package/lib/cjs/components/opening-times/hint-text/HintText.styles.js +26 -0
- package/lib/cjs/components/opening-times/hint-text/HintText.styles.js.map +1 -0
- package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.js +145 -0
- package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -0
- package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.styles.js +16 -0
- package/lib/cjs/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -0
- package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.js +106 -0
- package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -0
- package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +41 -0
- package/lib/cjs/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -0
- package/lib/cjs/constants/dateInfo.js +629 -0
- package/lib/cjs/constants/dateInfo.js.map +1 -0
- package/lib/cjs/index.js +28 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types/calendar.js +22 -0
- package/lib/cjs/types/calendar.js.map +1 -0
- package/lib/cjs/types/openingTimes.js +18 -0
- package/lib/cjs/types/openingTimes.js.map +1 -0
- package/lib/cjs/utils/calendar.js +54 -0
- package/lib/cjs/utils/calendar.js.map +1 -0
- package/lib/cjs/utils/dateInfo.js +368 -0
- package/lib/cjs/utils/dateInfo.js.map +1 -0
- package/lib/esm/components/calendar/Calendar.js.map +1 -0
- package/lib/esm/components/calendar/Calendar.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/Month.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/Month.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -0
- package/lib/esm/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -0
- package/lib/esm/components/date-info/DateInfo.js.map +1 -0
- package/lib/esm/components/opening-times/OpeningTimes.js.map +1 -0
- package/lib/esm/components/opening-times/OpeningTimes.styles.js.map +1 -0
- package/lib/esm/components/opening-times/hint-text/HintText.js.map +1 -0
- package/lib/esm/components/opening-times/hint-text/HintText.styles.js.map +1 -0
- package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -0
- package/lib/esm/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -0
- package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -0
- package/lib/esm/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -0
- package/lib/esm/constants/dateInfo.js.map +1 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types/calendar.js.map +1 -0
- package/lib/esm/types/openingTimes.js.map +1 -0
- package/lib/esm/utils/calendar.js.map +1 -0
- package/lib/{utils → esm/utils}/dateInfo.js +11 -2
- package/lib/esm/utils/dateInfo.js.map +1 -0
- package/lib/{components → types/components}/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.d.ts +1 -1
- package/lib/{components → types/components}/opening-times/OpeningTimes.styles.d.ts +1 -1
- package/lib/{components → types/components}/opening-times/hint-text/HintText.styles.d.ts +1 -1
- package/package.json +17 -7
- package/lib/components/calendar/Calendar.js.map +0 -1
- package/lib/components/calendar/Calendar.styles.js.map +0 -1
- package/lib/components/calendar/month-wrapper/MonthWrapper.js.map +0 -1
- package/lib/components/calendar/month-wrapper/MonthWrapper.styles.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/Month.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/Month.styles.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +0 -1
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +0 -1
- package/lib/components/date-info/DateInfo.js.map +0 -1
- package/lib/components/opening-times/OpeningTimes.js.map +0 -1
- package/lib/components/opening-times/OpeningTimes.styles.js.map +0 -1
- package/lib/components/opening-times/hint-text/HintText.js.map +0 -1
- package/lib/components/opening-times/hint-text/HintText.styles.js.map +0 -1
- package/lib/components/opening-times/opening-inputs/OpeningInputs.js.map +0 -1
- package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +0 -1
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +0 -1
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +0 -1
- package/lib/constants/dateInfo.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/types/calendar.js.map +0 -1
- package/lib/types/openingTimes.js.map +0 -1
- package/lib/utils/calendar.js.map +0 -1
- package/lib/utils/dateInfo.js.map +0 -1
- /package/lib/{components → esm/components}/calendar/Calendar.js +0 -0
- /package/lib/{components → esm/components}/calendar/Calendar.styles.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/MonthWrapper.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/MonthWrapper.styles.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/Month.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/Month.styles.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/day/Day.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +0 -0
- /package/lib/{components → esm/components}/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +0 -0
- /package/lib/{components → esm/components}/date-info/DateInfo.js +0 -0
- /package/lib/{components → esm/components}/opening-times/OpeningTimes.js +0 -0
- /package/lib/{components → esm/components}/opening-times/OpeningTimes.styles.js +0 -0
- /package/lib/{components → esm/components}/opening-times/hint-text/HintText.js +0 -0
- /package/lib/{components → esm/components}/opening-times/hint-text/HintText.styles.js +0 -0
- /package/lib/{components → esm/components}/opening-times/opening-inputs/OpeningInputs.js +0 -0
- /package/lib/{components → esm/components}/opening-times/opening-inputs/OpeningInputs.styles.js +0 -0
- /package/lib/{components → esm/components}/opening-times/opening-inputs/opening-input/OpeningInput.js +0 -0
- /package/lib/{components → esm/components}/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +0 -0
- /package/lib/{constants → esm/constants}/dateInfo.js +0 -0
- /package/lib/{index.js → esm/index.js} +0 -0
- /package/lib/{types → esm/types}/calendar.js +0 -0
- /package/lib/{types → esm/types}/openingTimes.js +0 -0
- /package/lib/{utils → esm/utils}/calendar.js +0 -0
- /package/lib/{components → types/components}/calendar/Calendar.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/Calendar.styles.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/MonthWrapper.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/MonthWrapper.styles.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/Month.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/Month.styles.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/DayWrapper.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/day/Day.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/day/Day.styles.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/day/category/Category.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.d.ts +0 -0
- /package/lib/{components → types/components}/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.d.ts +0 -0
- /package/lib/{components → types/components}/date-info/DateInfo.d.ts +0 -0
- /package/lib/{components → types/components}/opening-times/OpeningTimes.d.ts +0 -0
- /package/lib/{components → types/components}/opening-times/hint-text/HintText.d.ts +0 -0
- /package/lib/{components → types/components}/opening-times/opening-inputs/OpeningInputs.d.ts +0 -0
- /package/lib/{components → types/components}/opening-times/opening-inputs/OpeningInputs.styles.d.ts +0 -0
- /package/lib/{components → types/components}/opening-times/opening-inputs/opening-input/OpeningInput.d.ts +0 -0
- /package/lib/{components → types/components}/opening-times/opening-inputs/opening-input/OpeningInput.styles.d.ts +0 -0
- /package/lib/{constants → types/constants}/dateInfo.d.ts +0 -0
- /package/lib/{index.d.ts → types/index.d.ts} +0 -0
- /package/lib/types/{calendar.d.ts → types/calendar.d.ts} +0 -0
- /package/lib/types/{openingTimes.d.ts → types/openingTimes.d.ts} +0 -0
- /package/lib/{utils → types/utils}/calendar.d.ts +0 -0
- /package/lib/{utils → types/utils}/dateInfo.d.ts +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _dateFns = require("date-fns");
|
|
9
|
+
var _locale = require("date-fns/locale");
|
|
10
|
+
var _Calendar = require("./Calendar.styles");
|
|
11
|
+
var _calendar = require("../../utils/calendar");
|
|
12
|
+
var _core = require("@chayns-components/core");
|
|
13
|
+
var _MonthWrapper = _interopRequireDefault(require("./month-wrapper/MonthWrapper"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
const END_DATE = new Date(new Date().setFullYear(new Date().getFullYear() + 100));
|
|
18
|
+
const Calendar = ({
|
|
19
|
+
locale = _locale.de,
|
|
20
|
+
endDate = END_DATE,
|
|
21
|
+
startDate,
|
|
22
|
+
highlightedDates,
|
|
23
|
+
onSelect,
|
|
24
|
+
selectedDate,
|
|
25
|
+
categories
|
|
26
|
+
}) => {
|
|
27
|
+
const [currentDate, setCurrentDate] = (0, _react.useState)();
|
|
28
|
+
const [shouldRenderTwoMonths, setShouldRenderTwoMonths] = (0, _react.useState)(true);
|
|
29
|
+
const [internalSelectedDate, setInternalSelectedDate] = (0, _react.useState)();
|
|
30
|
+
const [direction, setDirection] = (0, _react.useState)();
|
|
31
|
+
const [width, setWidth] = (0, _react.useState)(0);
|
|
32
|
+
const calendarRef = (0, _react.useRef)(null);
|
|
33
|
+
(0, _react.useEffect)(() => {
|
|
34
|
+
if (selectedDate) {
|
|
35
|
+
setInternalSelectedDate(selectedDate);
|
|
36
|
+
}
|
|
37
|
+
}, [selectedDate]);
|
|
38
|
+
(0, _react.useEffect)(() => {
|
|
39
|
+
if (calendarRef.current) {
|
|
40
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
41
|
+
if (entries && entries[0]) {
|
|
42
|
+
const observedWidth = entries[0].contentRect.width;
|
|
43
|
+
setWidth(observedWidth - 30);
|
|
44
|
+
if (observedWidth < 430) {
|
|
45
|
+
setShouldRenderTwoMonths(false);
|
|
46
|
+
} else {
|
|
47
|
+
setShouldRenderTwoMonths(true);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
resizeObserver.observe(calendarRef.current);
|
|
52
|
+
return () => {
|
|
53
|
+
resizeObserver.disconnect();
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return () => {};
|
|
57
|
+
}, []);
|
|
58
|
+
(0, _react.useEffect)(() => {
|
|
59
|
+
const date = new Date();
|
|
60
|
+
setCurrentDate((0, _calendar.isDateInRange)({
|
|
61
|
+
startDate,
|
|
62
|
+
endDate,
|
|
63
|
+
currentDate: date
|
|
64
|
+
}));
|
|
65
|
+
}, [endDate, startDate]);
|
|
66
|
+
const handleLeftArrowClick = (0, _react.useCallback)(() => {
|
|
67
|
+
setDirection('left');
|
|
68
|
+
setCurrentDate(prevDate => {
|
|
69
|
+
if (!prevDate) {
|
|
70
|
+
return prevDate;
|
|
71
|
+
}
|
|
72
|
+
const newDate = (0, _calendar.getNewDate)(-1, prevDate);
|
|
73
|
+
return (0, _calendar.isDateInRange)({
|
|
74
|
+
startDate,
|
|
75
|
+
endDate,
|
|
76
|
+
currentDate: newDate
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}, [endDate, startDate]);
|
|
80
|
+
const handleRightArrowClick = (0, _react.useCallback)(() => {
|
|
81
|
+
setDirection('right');
|
|
82
|
+
setCurrentDate(prevDate => {
|
|
83
|
+
if (!prevDate) {
|
|
84
|
+
return prevDate;
|
|
85
|
+
}
|
|
86
|
+
const newDate = (0, _calendar.getNewDate)(1, prevDate);
|
|
87
|
+
return (0, _calendar.isDateInRange)({
|
|
88
|
+
startDate,
|
|
89
|
+
endDate,
|
|
90
|
+
currentDate: newDate
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}, [endDate, startDate]);
|
|
94
|
+
const handleSelect = (0, _react.useCallback)(date => {
|
|
95
|
+
setInternalSelectedDate(date);
|
|
96
|
+
if (typeof onSelect === 'function') {
|
|
97
|
+
onSelect(date);
|
|
98
|
+
}
|
|
99
|
+
}, [onSelect]);
|
|
100
|
+
const handleAnimationFinished = () => {
|
|
101
|
+
setDirection(undefined);
|
|
102
|
+
};
|
|
103
|
+
const ShouldShowLeftArrow = (0, _react.useMemo)(() => {
|
|
104
|
+
if (!currentDate) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return !(0, _dateFns.isSameMonth)(currentDate, startDate);
|
|
108
|
+
}, [currentDate, startDate]);
|
|
109
|
+
const ShouldShowRightArrow = (0, _react.useMemo)(() => {
|
|
110
|
+
if (!currentDate) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
return !(0, _dateFns.isSameMonth)(currentDate, endDate);
|
|
114
|
+
}, [currentDate, endDate]);
|
|
115
|
+
return /*#__PURE__*/_react.default.createElement(_Calendar.StyledCalendar, {
|
|
116
|
+
ref: calendarRef
|
|
117
|
+
}, ShouldShowLeftArrow ? /*#__PURE__*/_react.default.createElement(_Calendar.StyledCalendarIconWrapper, {
|
|
118
|
+
onClick: handleLeftArrowClick
|
|
119
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Icon, {
|
|
120
|
+
icons: ['fa fa-angle-left']
|
|
121
|
+
})) : /*#__PURE__*/_react.default.createElement(_Calendar.StyledCalendarIconWrapperPseudo, null), currentDate && /*#__PURE__*/_react.default.createElement(_MonthWrapper.default, {
|
|
122
|
+
shouldRenderTwo: shouldRenderTwoMonths,
|
|
123
|
+
currentDate: currentDate,
|
|
124
|
+
width: width,
|
|
125
|
+
locale: locale,
|
|
126
|
+
direction: direction,
|
|
127
|
+
onSelect: handleSelect,
|
|
128
|
+
selectedDate: internalSelectedDate,
|
|
129
|
+
highlightedDates: highlightedDates,
|
|
130
|
+
categories: categories,
|
|
131
|
+
onAnimationFinished: handleAnimationFinished
|
|
132
|
+
}), ShouldShowRightArrow ? /*#__PURE__*/_react.default.createElement(_Calendar.StyledCalendarIconWrapper, {
|
|
133
|
+
onClick: handleRightArrowClick
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Icon, {
|
|
135
|
+
icons: ['fa fa-angle-right']
|
|
136
|
+
})) : /*#__PURE__*/_react.default.createElement(_Calendar.StyledCalendarIconWrapperPseudo, null));
|
|
137
|
+
};
|
|
138
|
+
Calendar.displayName = 'Calendar';
|
|
139
|
+
var _default = exports.default = Calendar;
|
|
140
|
+
//# sourceMappingURL=Calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calendar.js","names":["_react","_interopRequireWildcard","require","_dateFns","_locale","_Calendar","_calendar","_core","_MonthWrapper","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","END_DATE","Date","setFullYear","getFullYear","Calendar","locale","de","endDate","startDate","highlightedDates","onSelect","selectedDate","categories","currentDate","setCurrentDate","useState","shouldRenderTwoMonths","setShouldRenderTwoMonths","internalSelectedDate","setInternalSelectedDate","direction","setDirection","width","setWidth","calendarRef","useRef","useEffect","current","resizeObserver","ResizeObserver","entries","observedWidth","contentRect","observe","disconnect","date","isDateInRange","handleLeftArrowClick","useCallback","prevDate","newDate","getNewDate","handleRightArrowClick","handleSelect","handleAnimationFinished","undefined","ShouldShowLeftArrow","useMemo","isSameMonth","ShouldShowRightArrow","createElement","StyledCalendar","ref","StyledCalendarIconWrapper","onClick","Icon","icons","StyledCalendarIconWrapperPseudo","shouldRenderTwo","onAnimationFinished","displayName","_default","exports"],"sources":["../../../../src/components/calendar/Calendar.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { isSameMonth, type Locale } from 'date-fns';\nimport { de } from 'date-fns/locale';\nimport {\n StyledCalendar,\n StyledCalendarIconWrapper,\n StyledCalendarIconWrapperPseudo,\n} from './Calendar.styles';\nimport { getNewDate, isDateInRange } from '../../utils/calendar';\nimport type { Categories, HighlightedDates } from '../../types/calendar';\nimport { Icon } from '@chayns-components/core';\nimport MonthWrapper from './month-wrapper/MonthWrapper';\n\nconst END_DATE = new Date(new Date().setFullYear(new Date().getFullYear() + 100));\n\nexport type CalendarProps = {\n /**\n * An array to group dates into a category.\n */\n categories?: Categories[];\n /**\n * The last Month that can be displayed.\n */\n endDate?: Date;\n /**\n * An array with dates and corresponding styles to highlight.\n */\n highlightedDates?: HighlightedDates[];\n /**\n * The locale language to format the dates.\n */\n locale?: Locale;\n /**\n * Function to be executed when a date is selected.\n * @param date\n */\n onSelect?: (date: Date) => void;\n /**\n * A date that should be preselected.\n */\n selectedDate?: Date;\n /**\n * The first Month that can be displayed.\n */\n startDate: Date;\n};\n\nconst Calendar: FC<CalendarProps> = ({\n locale = de,\n endDate = END_DATE,\n startDate,\n highlightedDates,\n onSelect,\n selectedDate,\n categories,\n}) => {\n const [currentDate, setCurrentDate] = useState<Date>();\n const [shouldRenderTwoMonths, setShouldRenderTwoMonths] = useState(true);\n const [internalSelectedDate, setInternalSelectedDate] = useState<Date>();\n const [direction, setDirection] = useState<'left' | 'right'>();\n const [width, setWidth] = useState(0);\n\n const calendarRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (selectedDate) {\n setInternalSelectedDate(selectedDate);\n }\n }, [selectedDate]);\n\n useEffect(() => {\n if (calendarRef.current) {\n const resizeObserver = new ResizeObserver((entries) => {\n if (entries && entries[0]) {\n const observedWidth = entries[0].contentRect.width;\n\n setWidth(observedWidth - 30);\n\n if (observedWidth < 430) {\n setShouldRenderTwoMonths(false);\n } else {\n setShouldRenderTwoMonths(true);\n }\n }\n });\n\n resizeObserver.observe(calendarRef.current);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n return () => {};\n }, []);\n\n useEffect(() => {\n const date = new Date();\n\n setCurrentDate(isDateInRange({ startDate, endDate, currentDate: date }));\n }, [endDate, startDate]);\n\n const handleLeftArrowClick = useCallback(() => {\n setDirection('left');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(-1, prevDate);\n\n return isDateInRange({ startDate, endDate, currentDate: newDate });\n });\n }, [endDate, startDate]);\n\n const handleRightArrowClick = useCallback(() => {\n setDirection('right');\n\n setCurrentDate((prevDate) => {\n if (!prevDate) {\n return prevDate;\n }\n\n const newDate = getNewDate(1, prevDate);\n\n return isDateInRange({ startDate, endDate, currentDate: newDate });\n });\n }, [endDate, startDate]);\n\n const handleSelect = useCallback(\n (date: Date) => {\n setInternalSelectedDate(date);\n\n if (typeof onSelect === 'function') {\n onSelect(date);\n }\n },\n [onSelect],\n );\n\n const handleAnimationFinished = () => {\n setDirection(undefined);\n };\n\n const ShouldShowLeftArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, startDate);\n }, [currentDate, startDate]);\n\n const ShouldShowRightArrow = useMemo(() => {\n if (!currentDate) {\n return false;\n }\n\n return !isSameMonth(currentDate, endDate);\n }, [currentDate, endDate]);\n\n return (\n <StyledCalendar ref={calendarRef}>\n {ShouldShowLeftArrow ? (\n <StyledCalendarIconWrapper onClick={handleLeftArrowClick}>\n <Icon icons={['fa fa-angle-left']} />\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n {currentDate && (\n <MonthWrapper\n shouldRenderTwo={shouldRenderTwoMonths}\n currentDate={currentDate}\n width={width}\n locale={locale}\n direction={direction}\n onSelect={handleSelect}\n selectedDate={internalSelectedDate}\n highlightedDates={highlightedDates}\n categories={categories}\n onAnimationFinished={handleAnimationFinished}\n />\n )}\n {ShouldShowRightArrow ? (\n <StyledCalendarIconWrapper onClick={handleRightArrowClick}>\n <Icon icons={['fa fa-angle-right']} />\n </StyledCalendarIconWrapper>\n ) : (\n <StyledCalendarIconWrapperPseudo />\n )}\n </StyledCalendar>\n );\n};\n\nCalendar.displayName = 'Calendar';\n\nexport default Calendar;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,O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BACrDpE,MAAA,CAAAY,OAAA,CAAAqE,aAAA,CAAC1E,KAAA,CAAA+E,IAAI;IAACC,KAAK,EAAE,CAAC,kBAAkB;EAAE,CAAE,CACb,CAAC,gBAE5BvF,MAAA,CAAAY,OAAA,CAAAqE,aAAA,CAAC5E,SAAA,CAAAmF,+BAA+B,MAAE,CACrC,EACA5C,WAAW,iBACR5C,MAAA,CAAAY,OAAA,CAAAqE,aAAA,CAACzE,aAAA,CAAAI,OAAY;IACT6E,eAAe,EAAE1C,qBAAsB;IACvCH,WAAW,EAAEA,WAAY;IACzBS,KAAK,EAAEA,KAAM;IACbjB,MAAM,EAAEA,MAAO;IACfe,SAAS,EAAEA,SAAU;IACrBV,QAAQ,EAAEiC,YAAa;IACvBhC,YAAY,EAAEO,oBAAqB;IACnCT,gBAAgB,EAAEA,gBAAiB;IACnCG,UAAU,EAAEA,UAAW;IACvB+C,mBAAmB,EAAEf;EAAwB,CAChD,CACJ,EACAK,oBAAoB,gBACjBhF,MAAA,CAAAY,OAAA,CAAAqE,aAAA,CAAC5E,SAAA,CAAA+E,yBAAyB;IAACC,OAAO,EAAEZ;EAAsB,gBACtDzE,MAAA,CAAAY,OAAA,CAAAqE,aAAA,CAAC1E,KAAA,CAAA+E,IAAI;IAACC,KAAK,EAAE,CAAC,mBAAmB;EAAE,CAAE,CACd,CAAC,gBAE5BvF,MAAA,CAAAY,OAAA,CAAAqE,aAAA,CAAC5E,SAAA,CAAAmF,+BAA+B,MAAE,CAE1B,CAAC;AAEzB,CAAC;AAEDrD,QAAQ,CAACwD,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjF,OAAA,GAEnBuB,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledCalendarIconWrapperPseudo = exports.StyledCalendarIconWrapper = exports.StyledCalendar = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const StyledCalendar = exports.StyledCalendar = _styledComponents.default.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
width: 100%;
|
|
12
|
+
`;
|
|
13
|
+
const StyledCalendarIconWrapper = exports.StyledCalendarIconWrapper = _styledComponents.default.div`
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
z-index: 2;
|
|
16
|
+
`;
|
|
17
|
+
const StyledCalendarIconWrapperPseudo = exports.StyledCalendarIconWrapperPseudo = _styledComponents.default.div`
|
|
18
|
+
width: 15px;
|
|
19
|
+
`;
|
|
20
|
+
//# sourceMappingURL=Calendar.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calendar.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledCalendar","exports","styled","div","StyledCalendarIconWrapper","StyledCalendarIconWrapperPseudo"],"sources":["../../../../src/components/calendar/Calendar.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledCalendar = styled.div`\n display: flex;\n width: 100%;\n`;\n\nexport const StyledCalendarIconWrapper = styled.div`\n cursor: pointer;\n z-index: 2;\n`;\n\nexport const StyledCalendarIconWrapperPseudo = styled.div`\n width: 15px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAGE,yBAAM,CAACC,GAAI;AACzC;AACA;AACA,CAAC;AAEM,MAAMC,yBAAyB,GAAAH,OAAA,CAAAG,yBAAA,GAAGF,yBAAM,CAACC,GAAI;AACpD;AACA;AACA,CAAC;AAEM,MAAME,+BAA+B,GAAAJ,OAAA,CAAAI,+BAAA,GAAGH,yBAAM,CAACC,GAAI;AAC1D;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _calendar = require("../../../utils/calendar");
|
|
9
|
+
var _Month = _interopRequireDefault(require("./month/Month"));
|
|
10
|
+
var _MonthWrapper = require("./MonthWrapper.styles");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
const MonthWrapper = ({
|
|
15
|
+
locale,
|
|
16
|
+
currentDate,
|
|
17
|
+
highlightedDates,
|
|
18
|
+
selectedDate,
|
|
19
|
+
onSelect,
|
|
20
|
+
categories,
|
|
21
|
+
direction,
|
|
22
|
+
onAnimationFinished,
|
|
23
|
+
shouldRenderTwo,
|
|
24
|
+
width
|
|
25
|
+
}) => {
|
|
26
|
+
const [content, setContent] = (0, _react.useState)();
|
|
27
|
+
const [prevSelectedDate, setPrevSelectedDate] = (0, _react.useState)();
|
|
28
|
+
(0, _react.useEffect)(() => {
|
|
29
|
+
if (prevSelectedDate !== selectedDate) {
|
|
30
|
+
setPrevSelectedDate(selectedDate);
|
|
31
|
+
}
|
|
32
|
+
}, [prevSelectedDate, selectedDate]);
|
|
33
|
+
(0, _react.useEffect)(() => {
|
|
34
|
+
setContent(prevState => {
|
|
35
|
+
// Initial render of months
|
|
36
|
+
if (!prevState) {
|
|
37
|
+
const items = [];
|
|
38
|
+
for (let i = -1; i < 3; i++) {
|
|
39
|
+
const date = (0, _calendar.getNewDate)(i, currentDate);
|
|
40
|
+
const {
|
|
41
|
+
month,
|
|
42
|
+
year
|
|
43
|
+
} = (0, _calendar.getMonthAndYear)(date);
|
|
44
|
+
items.push( /*#__PURE__*/_react.default.createElement(_Month.default, {
|
|
45
|
+
key: `${month}-${year}`,
|
|
46
|
+
month: month,
|
|
47
|
+
year: year,
|
|
48
|
+
locale: locale,
|
|
49
|
+
onSelect: onSelect,
|
|
50
|
+
highlightedDates: highlightedDates,
|
|
51
|
+
categories: categories,
|
|
52
|
+
selectedDate: selectedDate
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
return items;
|
|
56
|
+
}
|
|
57
|
+
if (direction === 'left') {
|
|
58
|
+
const date = (0, _calendar.getNewDate)(-1, currentDate);
|
|
59
|
+
const {
|
|
60
|
+
month,
|
|
61
|
+
year
|
|
62
|
+
} = (0, _calendar.getMonthAndYear)(date);
|
|
63
|
+
prevState.unshift( /*#__PURE__*/_react.default.createElement(_Month.default, {
|
|
64
|
+
key: `${month}-${year}`,
|
|
65
|
+
month: month,
|
|
66
|
+
year: year,
|
|
67
|
+
locale: locale,
|
|
68
|
+
onSelect: onSelect,
|
|
69
|
+
highlightedDates: highlightedDates,
|
|
70
|
+
categories: categories,
|
|
71
|
+
selectedDate: selectedDate
|
|
72
|
+
}));
|
|
73
|
+
prevState.pop();
|
|
74
|
+
}
|
|
75
|
+
if (direction === 'right') {
|
|
76
|
+
const date = (0, _calendar.getNewDate)(2, currentDate);
|
|
77
|
+
const {
|
|
78
|
+
month,
|
|
79
|
+
year
|
|
80
|
+
} = (0, _calendar.getMonthAndYear)(date);
|
|
81
|
+
prevState.push( /*#__PURE__*/_react.default.createElement(_Month.default, {
|
|
82
|
+
key: `${month}-${year}`,
|
|
83
|
+
month: month,
|
|
84
|
+
year: year,
|
|
85
|
+
locale: locale,
|
|
86
|
+
onSelect: onSelect,
|
|
87
|
+
highlightedDates: highlightedDates,
|
|
88
|
+
categories: categories,
|
|
89
|
+
selectedDate: selectedDate
|
|
90
|
+
}));
|
|
91
|
+
prevState.shift();
|
|
92
|
+
}
|
|
93
|
+
return prevState;
|
|
94
|
+
});
|
|
95
|
+
}, [categories, currentDate, direction, highlightedDates, locale, onSelect, prevSelectedDate, selectedDate]);
|
|
96
|
+
(0, _react.useEffect)(() => {
|
|
97
|
+
if (selectedDate) {
|
|
98
|
+
setContent(prevState => (prevState ?? []).map(element => ({
|
|
99
|
+
...element,
|
|
100
|
+
props: {
|
|
101
|
+
...element.props,
|
|
102
|
+
selectedDate
|
|
103
|
+
}
|
|
104
|
+
})));
|
|
105
|
+
}
|
|
106
|
+
}, [selectedDate]);
|
|
107
|
+
const animate = (0, _react.useMemo)(() => {
|
|
108
|
+
if (shouldRenderTwo) {
|
|
109
|
+
switch (true) {
|
|
110
|
+
case direction === 'left':
|
|
111
|
+
return {
|
|
112
|
+
x: '0%'
|
|
113
|
+
};
|
|
114
|
+
case direction === 'right':
|
|
115
|
+
return {
|
|
116
|
+
x: '-100%'
|
|
117
|
+
};
|
|
118
|
+
default:
|
|
119
|
+
return {
|
|
120
|
+
x: '-50%'
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
switch (true) {
|
|
125
|
+
case direction === 'left':
|
|
126
|
+
return {
|
|
127
|
+
x: '0%'
|
|
128
|
+
};
|
|
129
|
+
case direction === 'right':
|
|
130
|
+
return {
|
|
131
|
+
x: '-200%'
|
|
132
|
+
};
|
|
133
|
+
default:
|
|
134
|
+
return {
|
|
135
|
+
x: '-100%'
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, [direction, shouldRenderTwo]);
|
|
140
|
+
return /*#__PURE__*/_react.default.createElement(_MonthWrapper.StyledMonthWrapper, {
|
|
141
|
+
$height: shouldRenderTwo ? width / 2 : width
|
|
142
|
+
}, /*#__PURE__*/_react.default.createElement(_MonthWrapper.StyledMotionWrapper, {
|
|
143
|
+
animate: animate,
|
|
144
|
+
transition: {
|
|
145
|
+
type: 'tween',
|
|
146
|
+
duration: !direction ? 0 : 0.2
|
|
147
|
+
},
|
|
148
|
+
onAnimationComplete: onAnimationFinished
|
|
149
|
+
}, content));
|
|
150
|
+
};
|
|
151
|
+
MonthWrapper.displayName = 'MonthWrapper';
|
|
152
|
+
var _default = exports.default = MonthWrapper;
|
|
153
|
+
//# sourceMappingURL=MonthWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MonthWrapper.js","names":["_react","_interopRequireWildcard","require","_calendar","_Month","_interopRequireDefault","_MonthWrapper","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","MonthWrapper","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","content","setContent","useState","prevSelectedDate","setPrevSelectedDate","useEffect","prevState","items","date","getNewDate","month","year","getMonthAndYear","push","createElement","key","unshift","pop","shift","map","element","props","animate","useMemo","x","StyledMonthWrapper","$height","StyledMotionWrapper","transition","type","duration","onAnimationComplete","displayName","_default","exports"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import type { Locale } from 'date-fns';\nimport type { MotionProps } from 'framer-motion';\nimport React, { FC, useEffect, useMemo, useState, type ReactElement } from 'react';\nimport type { Categories, HighlightedDates } from '../../../types/calendar';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\nimport Month from './month/Month';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\n\nexport type MonthWrapperProps = {\n locale: Locale;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date;\n categories?: Categories[];\n currentDate: Date;\n direction?: 'left' | 'right';\n onAnimationFinished: () => void;\n shouldRenderTwo: boolean;\n width: number;\n};\n\nconst MonthWrapper: FC<MonthWrapperProps> = ({\n locale,\n currentDate,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n direction,\n onAnimationFinished,\n shouldRenderTwo,\n width,\n}) => {\n const [content, setContent] = useState<ReactElement[]>();\n const [prevSelectedDate, setPrevSelectedDate] = useState<Date>();\n\n useEffect(() => {\n if (prevSelectedDate !== selectedDate) {\n setPrevSelectedDate(selectedDate);\n }\n }, [prevSelectedDate, selectedDate]);\n\n useEffect(() => {\n setContent((prevState) => {\n // Initial render of months\n if (!prevState) {\n const items: ReactElement[] = [];\n\n for (let i = -1; i < 3; i++) {\n const date = getNewDate(i, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n items.push(\n <Month\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n }\n\n return items;\n }\n\n if (direction === 'left') {\n const date = getNewDate(-1, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.unshift(\n <Month\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.pop();\n }\n\n if (direction === 'right') {\n const date = getNewDate(2, currentDate);\n\n const { month, year } = getMonthAndYear(date);\n\n prevState.push(\n <Month\n key={`${month}-${year}`}\n month={month}\n year={year}\n locale={locale}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n categories={categories}\n selectedDate={selectedDate}\n />,\n );\n prevState.shift();\n }\n\n return prevState;\n });\n }, [\n categories,\n currentDate,\n direction,\n highlightedDates,\n locale,\n onSelect,\n prevSelectedDate,\n selectedDate,\n ]);\n\n useEffect(() => {\n if (selectedDate) {\n setContent((prevState) =>\n (prevState ?? []).map((element) => ({\n ...element,\n props: { ...element.props, selectedDate } as ReactElement,\n })),\n );\n }\n }, [selectedDate]);\n\n const animate: MotionProps['animate'] = useMemo(() => {\n if (shouldRenderTwo) {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-100%' };\n default:\n return { x: '-50%' };\n }\n } else {\n switch (true) {\n case direction === 'left':\n return { x: '0%' };\n case direction === 'right':\n return { x: '-200%' };\n default:\n return { x: '-100%' };\n }\n }\n }, [direction, shouldRenderTwo]);\n\n return (\n <StyledMonthWrapper $height={shouldRenderTwo ? width / 2 : width}>\n <StyledMotionWrapper\n animate={animate}\n transition={{\n type: 'tween',\n duration: !direction ? 0 : 0.2,\n }}\n onAnimationComplete={onAnimationFinished}\n >\n {content}\n </StyledMotionWrapper>\n </StyledMonthWrapper>\n );\n};\n\nMonthWrapper.displayName = 'MonthWrapper';\n\nexport default MonthWrapper;\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAgF,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAA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,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhE,OAAA,GAE3BmB,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledMotionWrapper = exports.StyledMonthWrapper = void 0;
|
|
7
|
+
var _framerMotion = require("framer-motion");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const StyledMonthWrapper = exports.StyledMonthWrapper = _styledComponents.default.div`
|
|
11
|
+
width: 100%;
|
|
12
|
+
overflow-x: clip;
|
|
13
|
+
height: ${({
|
|
14
|
+
$height
|
|
15
|
+
}) => $height}px;
|
|
16
|
+
`;
|
|
17
|
+
const StyledMotionWrapper = exports.StyledMotionWrapper = (0, _styledComponents.default)(_framerMotion.motion.div)`
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 100%;
|
|
20
|
+
`;
|
|
21
|
+
//# sourceMappingURL=MonthWrapper.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MonthWrapper.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","obj","__esModule","default","StyledMonthWrapper","exports","styled","div","$height","StyledMotionWrapper","motion"],"sources":["../../../../../src/components/calendar/month-wrapper/MonthWrapper.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\ntype StyledMonthWrapperProps = WithTheme<{ $height: number }>;\n\nexport const StyledMonthWrapper = styled.div<StyledMonthWrapperProps>`\n width: 100%;\n overflow-x: clip;\n height: ${({ $height }) => $height}px;\n`;\n\nexport const StyledMotionWrapper = styled(motion.div)`\n display: flex;\n height: 100%;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAA6B;AACtE;AACA;AACA,cAAc,CAAC;EAAEC;AAAQ,CAAC,KAAKA,OAAQ;AACvC,CAAC;AAEM,MAAMC,mBAAmB,GAAAJ,OAAA,CAAAI,mBAAA,GAAG,IAAAH,yBAAM,EAACI,oBAAM,CAACH,GAAG,CAAE;AACtD;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _Month = require("./Month.styles");
|
|
9
|
+
var _WeekdayWrapper = _interopRequireDefault(require("./weekday-wrapper/WeekdayWrapper"));
|
|
10
|
+
var _DayWrapper = _interopRequireDefault(require("./day-wrapper/DayWrapper"));
|
|
11
|
+
var _calendar = require("../../../../utils/calendar");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
const Month = ({
|
|
16
|
+
month,
|
|
17
|
+
year,
|
|
18
|
+
locale,
|
|
19
|
+
highlightedDates,
|
|
20
|
+
selectedDate,
|
|
21
|
+
onSelect,
|
|
22
|
+
categories
|
|
23
|
+
}) => {
|
|
24
|
+
const [currentYear] = (0, _react.useState)(new Date().getFullYear());
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_Month.StyledMonth, null, /*#__PURE__*/_react.default.createElement(_Month.StyledMonthHead, null, /*#__PURE__*/_react.default.createElement(_Month.StyledMonthName, null, `${(0, _calendar.formatMonth)({
|
|
26
|
+
locale,
|
|
27
|
+
month
|
|
28
|
+
})} ${String(currentYear) !== year ? year : ''}`)), /*#__PURE__*/_react.default.createElement(_WeekdayWrapper.default, {
|
|
29
|
+
locale: locale
|
|
30
|
+
}), /*#__PURE__*/_react.default.createElement(_DayWrapper.default, {
|
|
31
|
+
key: `day-wrapper-${month}`,
|
|
32
|
+
categories: categories,
|
|
33
|
+
selectedDate: selectedDate,
|
|
34
|
+
month: month,
|
|
35
|
+
year: year,
|
|
36
|
+
onSelect: onSelect,
|
|
37
|
+
highlightedDates: highlightedDates
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
Month.displayName = 'Month';
|
|
41
|
+
var _default = exports.default = Month;
|
|
42
|
+
//# sourceMappingURL=Month.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Month.js","names":["_react","_interopRequireWildcard","require","_Month","_WeekdayWrapper","_interopRequireDefault","_DayWrapper","_calendar","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Month","month","year","locale","highlightedDates","selectedDate","onSelect","categories","currentYear","useState","Date","getFullYear","createElement","StyledMonth","StyledMonthHead","StyledMonthName","formatMonth","String","key","displayName","_default","exports"],"sources":["../../../../../../src/components/calendar/month-wrapper/month/Month.tsx"],"sourcesContent":["import React, { FC, useState } from 'react';\nimport { StyledMonth, StyledMonthHead, StyledMonthName } from './Month.styles';\nimport WeekdayWrapper from './weekday-wrapper/WeekdayWrapper';\nimport DayWrapper from './day-wrapper/DayWrapper';\nimport type { Locale } from 'date-fns';\nimport type { Categories, EMonth, HighlightedDates } from '../../../../types/calendar';\nimport { formatMonth } from '../../../../utils/calendar';\n\nexport type MonthProps = {\n month: EMonth;\n year: string;\n locale: Locale;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date;\n categories?: Categories[];\n};\n\nconst Month: FC<MonthProps> = ({\n month,\n year,\n locale,\n highlightedDates,\n selectedDate,\n onSelect,\n categories,\n}) => {\n const [currentYear] = useState(new Date().getFullYear());\n\n return (\n <StyledMonth>\n <StyledMonthHead>\n <StyledMonthName>{`${formatMonth({ locale, month })} ${String(currentYear) !== year ? year : ''}`}</StyledMonthName>\n </StyledMonthHead>\n <WeekdayWrapper locale={locale} />\n <DayWrapper\n key={`day-wrapper-${month}`}\n categories={categories}\n selectedDate={selectedDate}\n month={month}\n year={year}\n onSelect={onSelect}\n highlightedDates={highlightedDates}\n />\n </StyledMonth>\n );\n};\n\nMonth.displayName = 'Month';\n\nexport default Month;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AAGA,IAAAK,SAAA,GAAAL,OAAA;AAAyD,SAAAG,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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W,CAAC,GAAG,IAAAC,eAAQ,EAAC,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC;EAExD,oBACIxC,MAAA,CAAAU,OAAA,CAAA+B,aAAA,CAACtC,MAAA,CAAAuC,WAAW,qBACR1C,MAAA,CAAAU,OAAA,CAAA+B,aAAA,CAACtC,MAAA,CAAAwC,eAAe,qBACZ3C,MAAA,CAAAU,OAAA,CAAA+B,aAAA,CAACtC,MAAA,CAAAyC,eAAe,QAAG,GAAE,IAAAC,qBAAW,EAAC;IAAEb,MAAM;IAAEF;EAAM,CAAC,CAAE,IAAGgB,MAAM,CAACT,WAAW,CAAC,KAAKN,IAAI,GAAGA,IAAI,GAAG,EAAG,EAAmB,CACtG,CAAC,eAClB/B,MAAA,CAAAU,OAAA,CAAA+B,aAAA,CAACrC,eAAA,CAAAM,OAAc;IAACsB,MAAM,EAAEA;EAAO,CAAE,CAAC,eAClChC,MAAA,CAAAU,OAAA,CAAA+B,aAAA,CAACnC,WAAA,CAAAI,OAAU;IACPqC,GAAG,EAAG,eAAcjB,KAAM,EAAE;IAC5BM,UAAU,EAAEA,UAAW;IACvBF,YAAY,EAAEA,YAAa;IAC3BJ,KAAK,EAAEA,KAAM;IACbC,IAAI,EAAEA,IAAK;IACXI,QAAQ,EAAEA,QAAS;IACnBF,gBAAgB,EAAEA;EAAiB,CACtC,CACQ,CAAC;AAEtB,CAAC;AAEDJ,KAAK,CAACmB,WAAW,GAAG,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxC,OAAA,GAEbmB,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledMonthName = exports.StyledMonthHead = exports.StyledMonth = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const StyledMonth = exports.StyledMonth = _styledComponents.default.div`
|
|
10
|
+
height: 100%;
|
|
11
|
+
aspect-ratio: 1;
|
|
12
|
+
`;
|
|
13
|
+
const StyledMonthHead = exports.StyledMonthHead = _styledComponents.default.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
`;
|
|
17
|
+
const StyledMonthName = exports.StyledMonthName = _styledComponents.default.div`
|
|
18
|
+
font-weight: bold;
|
|
19
|
+
width: 100%;
|
|
20
|
+
text-align: center;
|
|
21
|
+
user-select: none;
|
|
22
|
+
`;
|
|
23
|
+
//# sourceMappingURL=Month.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Month.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledMonth","exports","styled","div","StyledMonthHead","StyledMonthName"],"sources":["../../../../../../src/components/calendar/month-wrapper/month/Month.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledMonth = styled.div`\n height: 100%;\n aspect-ratio: 1;\n`;\n\nexport const StyledMonthHead = styled.div`\n display: flex;\n align-items: center;\n`;\n\nexport const StyledMonthName = styled.div`\n font-weight: bold;\n width: 100%;\n text-align: center;\n user-select: none;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAGE,yBAAM,CAACC,GAAI;AACtC;AACA;AACA,CAAC;AAEM,MAAMC,eAAe,GAAAH,OAAA,CAAAG,eAAA,GAAGF,yBAAM,CAACC,GAAI;AAC1C;AACA;AACA,CAAC;AAEM,MAAME,eAAe,GAAAJ,OAAA,CAAAI,eAAA,GAAGH,yBAAM,CAACC,GAAI;AAC1C;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _dateFns = require("date-fns");
|
|
9
|
+
var _DayWrapper = require("./DayWrapper.styles");
|
|
10
|
+
var _Day = _interopRequireDefault(require("./day/Day"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
const DayWrapper = ({
|
|
15
|
+
month,
|
|
16
|
+
year,
|
|
17
|
+
highlightedDates,
|
|
18
|
+
onSelect,
|
|
19
|
+
selectedDate,
|
|
20
|
+
categories
|
|
21
|
+
}) => {
|
|
22
|
+
const dayOfCurrentMonth = (0, _react.useMemo)(() => new Date(Number(year), month - 1, 13), [month, year]);
|
|
23
|
+
const days = (0, _react.useMemo)(() => {
|
|
24
|
+
const dateArray = [];
|
|
25
|
+
const currentDate = (0, _dateFns.startOfMonth)(dayOfCurrentMonth);
|
|
26
|
+
const startDay = (0, _dateFns.startOfWeek)(currentDate, {
|
|
27
|
+
weekStartsOn: 1
|
|
28
|
+
});
|
|
29
|
+
for (let i = 0; i < 42; i++) {
|
|
30
|
+
const newDate = (0, _dateFns.addDays)(startDay, i);
|
|
31
|
+
dateArray.push(newDate);
|
|
32
|
+
}
|
|
33
|
+
return dateArray;
|
|
34
|
+
}, [dayOfCurrentMonth]);
|
|
35
|
+
const handleDayClick = (0, _react.useCallback)((date, shouldFireEvent) => {
|
|
36
|
+
if (shouldFireEvent) {
|
|
37
|
+
onSelect(date);
|
|
38
|
+
}
|
|
39
|
+
}, [onSelect]);
|
|
40
|
+
const dayElements = (0, _react.useMemo)(() => {
|
|
41
|
+
const items = [];
|
|
42
|
+
days.forEach(day => {
|
|
43
|
+
items.push( /*#__PURE__*/_react.default.createElement(_Day.default, {
|
|
44
|
+
key: `single-day-${day.toDateString()}`,
|
|
45
|
+
categories: categories,
|
|
46
|
+
date: day,
|
|
47
|
+
isSelected: selectedDate ? (0, _dateFns.isSameDay)(day, selectedDate) : false,
|
|
48
|
+
isSameMonth: (0, _dateFns.isSameMonth)(day, dayOfCurrentMonth),
|
|
49
|
+
onClick: handleDayClick,
|
|
50
|
+
highlightedDates: highlightedDates
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
53
|
+
return items;
|
|
54
|
+
}, [categories, dayOfCurrentMonth, days, handleDayClick, highlightedDates, selectedDate]);
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_DayWrapper.StyledDayWrapper, null, dayElements);
|
|
56
|
+
};
|
|
57
|
+
DayWrapper.displayName = 'DayWrapper';
|
|
58
|
+
var _default = exports.default = DayWrapper;
|
|
59
|
+
//# sourceMappingURL=DayWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayWrapper.js","names":["_react","_interopRequireWildcard","require","_dateFns","_DayWrapper","_Day","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DayWrapper","month","year","highlightedDates","onSelect","selectedDate","categories","dayOfCurrentMonth","useMemo","Date","Number","days","dateArray","currentDate","startOfMonth","startDay","startOfWeek","weekStartsOn","newDate","addDays","push","handleDayClick","useCallback","date","shouldFireEvent","dayElements","items","forEach","day","createElement","key","toDateString","isSelected","isSameDay","isSameMonth","onClick","StyledDayWrapper","displayName","_default","exports"],"sources":["../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.tsx"],"sourcesContent":["import React, { FC, type ReactElement, useCallback, useMemo } from 'react';\nimport { startOfMonth, startOfWeek, addDays, isSameMonth, isSameDay } from 'date-fns';\nimport { StyledDayWrapper } from './DayWrapper.styles';\nimport Day from './day/Day';\nimport type { Categories, EMonth, HighlightedDates } from '../../../../../types/calendar';\n\nexport type DayWrapperProps = {\n month: EMonth;\n year: string;\n highlightedDates?: HighlightedDates[];\n onSelect: (date: Date) => void;\n selectedDate?: Date;\n categories?: Categories[];\n};\n\nconst DayWrapper: FC<DayWrapperProps> = ({\n month,\n year,\n highlightedDates,\n onSelect,\n selectedDate,\n categories,\n}) => {\n const dayOfCurrentMonth = useMemo(() => new Date(Number(year), month - 1, 13), [month, year]);\n\n const days = useMemo(() => {\n const dateArray: Date[] = [];\n\n const currentDate = startOfMonth(dayOfCurrentMonth);\n\n const startDay = startOfWeek(currentDate, { weekStartsOn: 1 });\n\n for (let i = 0; i < 42; i++) {\n const newDate = addDays(startDay, i);\n dateArray.push(newDate);\n }\n\n return dateArray;\n }, [dayOfCurrentMonth]);\n\n const handleDayClick = useCallback(\n (date: Date, shouldFireEvent: boolean) => {\n if (shouldFireEvent) {\n onSelect(date);\n }\n },\n [onSelect],\n );\n\n const dayElements = useMemo(() => {\n const items: ReactElement[] = [];\n\n days.forEach((day) => {\n items.push(\n <Day\n key={`single-day-${day.toDateString()}`}\n categories={categories}\n date={day}\n isSelected={selectedDate ? isSameDay(day, selectedDate) : false}\n isSameMonth={isSameMonth(day, dayOfCurrentMonth)}\n onClick={handleDayClick}\n highlightedDates={highlightedDates}\n />,\n );\n });\n\n return items;\n }, [categories, dayOfCurrentMonth, days, handleDayClick, highlightedDates, selectedDate]);\n\n return <StyledDayWrapper>{dayElements}</StyledDayWrapper>;\n};\n\nDayWrapper.displayName = 'DayWrapper';\n\nexport default DayWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAA4B,SAAAI,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE,GAAA,CAAAL,CAAA,OAAAM,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAZ,CAAA,oBAAAY,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAd,CAAA,EAAAY,CAAA,SAAAG,CAAA,GA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
|
5
|
+
});
|
|
6
|
+
exports.StyledDayWrapper = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const StyledDayWrapper = exports.StyledDayWrapper = _styledComponents.default.div`
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-rows: repeat(6, 1fr);
|
|
12
|
+
grid-template-columns: repeat(7, 1fr);
|
|
13
|
+
padding-top: 6px;
|
|
14
|
+
gap: 2px;
|
|
15
|
+
margin: 0 15px;
|
|
16
|
+
`;
|
|
17
|
+
//# sourceMappingURL=DayWrapper.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayWrapper.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledDayWrapper","exports","styled","div"],"sources":["../../../../../../../src/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledDayWrapper = styled.div`\n display: grid;\n grid-template-rows: repeat(6, 1fr);\n grid-template-columns: repeat(7, 1fr);\n padding-top: 6px;\n gap: 2px;\n margin: 0 15px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|