@chayns-components/date 5.0.0-beta.441 → 5.0.0-beta.443
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/components/calendar/Calendar.js +37 -46
- package/lib/components/calendar/Calendar.js.map +1 -1
- package/lib/components/calendar/Calendar.styles.js +4 -11
- package/lib/components/calendar/Calendar.styles.js.map +1 -1
- package/lib/components/calendar/month-wrapper/MonthWrapper.js +19 -28
- package/lib/components/calendar/month-wrapper/MonthWrapper.js.map +1 -1
- package/lib/components/calendar/month-wrapper/MonthWrapper.styles.js +4 -11
- package/lib/components/calendar/month-wrapper/MonthWrapper.styles.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/Month.js +10 -19
- package/lib/components/calendar/month-wrapper/month/Month.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/Month.styles.js +4 -11
- package/lib/components/calendar/month-wrapper/month/Month.styles.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js +16 -25
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js +2 -9
- package/lib/components/calendar/month-wrapper/month/day-wrapper/DayWrapper.styles.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.js +15 -24
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js +6 -14
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/Day.styles.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js +4 -11
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js +2 -9
- package/lib/components/calendar/month-wrapper/month/day-wrapper/day/category/Category.styles.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js +12 -21
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js +2 -9
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/WeekdayWrapper.styles.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js +4 -11
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.js.map +1 -1
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js +2 -9
- package/lib/components/calendar/month-wrapper/month/weekday-wrapper/weekday/Weekday.styles.js.map +1 -1
- package/lib/components/date-info/DateInfo.js +20 -28
- package/lib/components/date-info/DateInfo.js.map +1 -1
- package/lib/components/opening-times/OpeningTimes.js +16 -25
- package/lib/components/opening-times/OpeningTimes.js.map +1 -1
- package/lib/components/opening-times/OpeningTimes.styles.js +3 -10
- package/lib/components/opening-times/OpeningTimes.styles.js.map +1 -1
- package/lib/components/opening-times/opening-inputs/OpeningInputs.js +19 -28
- package/lib/components/opening-times/opening-inputs/OpeningInputs.js.map +1 -1
- package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.js +2 -9
- package/lib/components/opening-times/opening-inputs/OpeningInputs.styles.js.map +1 -1
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.js +21 -29
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.js.map +1 -1
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js +7 -14
- package/lib/components/opening-times/opening-inputs/opening-input/OpeningInput.styles.js.map +1 -1
- package/lib/constants/dateInfo.js +1 -7
- package/lib/constants/dateInfo.js.map +1 -1
- package/lib/index.js +3 -27
- package/lib/index.js.map +1 -1
- package/lib/types/calendar.js +1 -7
- package/lib/types/calendar.js.map +1 -1
- package/lib/types/openingTimes.js +1 -7
- package/lib/types/openingTimes.js.map +1 -1
- package/lib/utils/calendar.js +11 -21
- package/lib/utils/calendar.js.map +1 -1
- package/lib/utils/dateInfo.js +35 -52
- package/lib/utils/dateInfo.js.map +1 -1
- package/package.json +10 -10
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
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 && Object.prototype.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; }
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { isSameMonth } from 'date-fns';
|
|
3
|
+
import { de } from 'date-fns/locale';
|
|
4
|
+
import { StyledCalendar, StyledCalendarIconWrapper, StyledCalendarIconWrapperPseudo } from './Calendar.styles';
|
|
5
|
+
import { getNewDate, isDateInRange } from '../../utils/calendar';
|
|
6
|
+
import { Icon } from '@chayns-components/core';
|
|
7
|
+
import MonthWrapper from './month-wrapper/MonthWrapper';
|
|
17
8
|
const END_DATE = new Date(new Date().setFullYear(new Date().getFullYear() + 100));
|
|
18
9
|
const Calendar = _ref => {
|
|
19
10
|
let {
|
|
20
|
-
locale =
|
|
11
|
+
locale = de,
|
|
21
12
|
endDate = END_DATE,
|
|
22
13
|
startDate,
|
|
23
14
|
highlightedDates,
|
|
@@ -25,18 +16,18 @@ const Calendar = _ref => {
|
|
|
25
16
|
selectedDate,
|
|
26
17
|
categories
|
|
27
18
|
} = _ref;
|
|
28
|
-
const [currentDate, setCurrentDate] =
|
|
29
|
-
const [shouldRenderTwoMonths, setShouldRenderTwoMonths] =
|
|
30
|
-
const [internalSelectedDate, setInternalSelectedDate] =
|
|
31
|
-
const [direction, setDirection] =
|
|
32
|
-
const [width, setWidth] =
|
|
33
|
-
const calendarRef =
|
|
34
|
-
|
|
19
|
+
const [currentDate, setCurrentDate] = useState();
|
|
20
|
+
const [shouldRenderTwoMonths, setShouldRenderTwoMonths] = useState(true);
|
|
21
|
+
const [internalSelectedDate, setInternalSelectedDate] = useState();
|
|
22
|
+
const [direction, setDirection] = useState();
|
|
23
|
+
const [width, setWidth] = useState(0);
|
|
24
|
+
const calendarRef = useRef(null);
|
|
25
|
+
useEffect(() => {
|
|
35
26
|
if (selectedDate) {
|
|
36
27
|
setInternalSelectedDate(selectedDate);
|
|
37
28
|
}
|
|
38
29
|
}, [selectedDate]);
|
|
39
|
-
|
|
30
|
+
useEffect(() => {
|
|
40
31
|
if (calendarRef.current) {
|
|
41
32
|
const resizeObserver = new ResizeObserver(entries => {
|
|
42
33
|
if (entries && entries[0]) {
|
|
@@ -56,43 +47,43 @@ const Calendar = _ref => {
|
|
|
56
47
|
}
|
|
57
48
|
return () => {};
|
|
58
49
|
}, []);
|
|
59
|
-
|
|
50
|
+
useEffect(() => {
|
|
60
51
|
const date = new Date();
|
|
61
|
-
setCurrentDate(
|
|
52
|
+
setCurrentDate(isDateInRange({
|
|
62
53
|
startDate,
|
|
63
54
|
endDate,
|
|
64
55
|
currentDate: date
|
|
65
56
|
}));
|
|
66
57
|
}, [endDate, startDate]);
|
|
67
|
-
const handleLeftArrowClick =
|
|
58
|
+
const handleLeftArrowClick = useCallback(() => {
|
|
68
59
|
setDirection('left');
|
|
69
60
|
setCurrentDate(prevDate => {
|
|
70
61
|
if (!prevDate) {
|
|
71
62
|
return prevDate;
|
|
72
63
|
}
|
|
73
|
-
const newDate =
|
|
74
|
-
return
|
|
64
|
+
const newDate = getNewDate(-1, prevDate);
|
|
65
|
+
return isDateInRange({
|
|
75
66
|
startDate,
|
|
76
67
|
endDate,
|
|
77
68
|
currentDate: newDate
|
|
78
69
|
});
|
|
79
70
|
});
|
|
80
71
|
}, [endDate, startDate]);
|
|
81
|
-
const handleRightArrowClick =
|
|
72
|
+
const handleRightArrowClick = useCallback(() => {
|
|
82
73
|
setDirection('right');
|
|
83
74
|
setCurrentDate(prevDate => {
|
|
84
75
|
if (!prevDate) {
|
|
85
76
|
return prevDate;
|
|
86
77
|
}
|
|
87
|
-
const newDate =
|
|
88
|
-
return
|
|
78
|
+
const newDate = getNewDate(1, prevDate);
|
|
79
|
+
return isDateInRange({
|
|
89
80
|
startDate,
|
|
90
81
|
endDate,
|
|
91
82
|
currentDate: newDate
|
|
92
83
|
});
|
|
93
84
|
});
|
|
94
85
|
}, [endDate, startDate]);
|
|
95
|
-
const handleSelect =
|
|
86
|
+
const handleSelect = useCallback(date => {
|
|
96
87
|
setInternalSelectedDate(date);
|
|
97
88
|
if (typeof onSelect === 'function') {
|
|
98
89
|
onSelect(date);
|
|
@@ -101,25 +92,25 @@ const Calendar = _ref => {
|
|
|
101
92
|
const handleAnimationFinished = () => {
|
|
102
93
|
setDirection(undefined);
|
|
103
94
|
};
|
|
104
|
-
const ShouldShowLeftArrow =
|
|
95
|
+
const ShouldShowLeftArrow = useMemo(() => {
|
|
105
96
|
if (!currentDate) {
|
|
106
97
|
return false;
|
|
107
98
|
}
|
|
108
|
-
return !
|
|
99
|
+
return !isSameMonth(currentDate, startDate);
|
|
109
100
|
}, [currentDate, startDate]);
|
|
110
|
-
const ShouldShowRightArrow =
|
|
101
|
+
const ShouldShowRightArrow = useMemo(() => {
|
|
111
102
|
if (!currentDate) {
|
|
112
103
|
return false;
|
|
113
104
|
}
|
|
114
|
-
return !
|
|
105
|
+
return !isSameMonth(currentDate, endDate);
|
|
115
106
|
}, [currentDate, endDate]);
|
|
116
|
-
return /*#__PURE__*/
|
|
107
|
+
return /*#__PURE__*/React.createElement(StyledCalendar, {
|
|
117
108
|
ref: calendarRef
|
|
118
|
-
}, ShouldShowLeftArrow ? /*#__PURE__*/
|
|
109
|
+
}, ShouldShowLeftArrow ? /*#__PURE__*/React.createElement(StyledCalendarIconWrapper, {
|
|
119
110
|
onClick: handleLeftArrowClick
|
|
120
|
-
}, /*#__PURE__*/
|
|
111
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
121
112
|
icons: ['fa fa-angle-left']
|
|
122
|
-
})) : /*#__PURE__*/
|
|
113
|
+
})) : /*#__PURE__*/React.createElement(StyledCalendarIconWrapperPseudo, null), currentDate && /*#__PURE__*/React.createElement(MonthWrapper, {
|
|
123
114
|
shouldRenderTwo: shouldRenderTwoMonths,
|
|
124
115
|
currentDate: currentDate,
|
|
125
116
|
width: width,
|
|
@@ -130,12 +121,12 @@ const Calendar = _ref => {
|
|
|
130
121
|
highlightedDates: highlightedDates,
|
|
131
122
|
categories: categories,
|
|
132
123
|
onAnimationFinished: handleAnimationFinished
|
|
133
|
-
}), ShouldShowRightArrow ? /*#__PURE__*/
|
|
124
|
+
}), ShouldShowRightArrow ? /*#__PURE__*/React.createElement(StyledCalendarIconWrapper, {
|
|
134
125
|
onClick: handleRightArrowClick
|
|
135
|
-
}, /*#__PURE__*/
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
136
127
|
icons: ['fa fa-angle-right']
|
|
137
|
-
})) : /*#__PURE__*/
|
|
128
|
+
})) : /*#__PURE__*/React.createElement(StyledCalendarIconWrapperPseudo, null));
|
|
138
129
|
};
|
|
139
130
|
Calendar.displayName = 'Calendar';
|
|
140
|
-
|
|
131
|
+
export default Calendar;
|
|
141
132
|
//# sourceMappingURL=Calendar.js.map
|
|
@@ -1 +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","prototype","hasOwnProperty","call","i","set","END_DATE","Date","setFullYear","getFullYear","Calendar","_ref","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,GAAA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calendar.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","isSameMonth","de","StyledCalendar","StyledCalendarIconWrapper","StyledCalendarIconWrapperPseudo","getNewDate","isDateInRange","Icon","MonthWrapper","END_DATE","Date","setFullYear","getFullYear","Calendar","_ref","locale","endDate","startDate","highlightedDates","onSelect","selectedDate","categories","currentDate","setCurrentDate","shouldRenderTwoMonths","setShouldRenderTwoMonths","internalSelectedDate","setInternalSelectedDate","direction","setDirection","width","setWidth","calendarRef","current","resizeObserver","ResizeObserver","entries","observedWidth","contentRect","observe","disconnect","date","handleLeftArrowClick","prevDate","newDate","handleRightArrowClick","handleSelect","handleAnimationFinished","undefined","ShouldShowLeftArrow","ShouldShowRightArrow","createElement","ref","onClick","icons","shouldRenderTwo","onAnimationFinished","displayName"],"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,OAAOA,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACpF,SAASC,WAAW,QAAqB,UAAU;AACnD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACIC,cAAc,EACdC,yBAAyB,EACzBC,+BAA+B,QAC5B,mBAAmB;AAC1B,SAASC,UAAU,EAAEC,aAAa,QAAQ,sBAAsB;AAEhE,SAASC,IAAI,QAAQ,yBAAyB;AAC9C,OAAOC,YAAY,MAAM,8BAA8B;AAEvD,MAAMC,QAAQ,GAAG,IAAIC,IAAI,CAAC,IAAIA,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,IAAID,IAAI,CAAC,CAAC,CAACE,WAAW,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AA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MAAM,EAAEA,MAAO;IACfa,SAAS,EAAEA,SAAU;IACrBT,QAAQ,EAAE2B,YAAa;IACvB1B,YAAY,EAAEM,oBAAqB;IACnCR,gBAAgB,EAAEA,gBAAiB;IACnCG,UAAU,EAAEA,UAAW;IACvBmC,mBAAmB,EAAET;EAAwB,CAChD,CACJ,EACAG,oBAAoB,gBACjBxD,KAAA,CAAAyD,aAAA,CAAChD,yBAAyB;IAACkD,OAAO,EAAER;EAAsB,gBACtDnD,KAAA,CAAAyD,aAAA,CAAC5C,IAAI;IAAC+C,KAAK,EAAE,CAAC,mBAAmB;EAAE,CAAE,CACd,CAAC,gBAE5B5D,KAAA,CAAAyD,aAAA,CAAC/C,+BAA+B,MAAE,CAE1B,CAAC;AAEzB,CAAC;AAEDS,QAAQ,CAAC4C,WAAW,GAAG,UAAU;AAEjC,eAAe5C,QAAQ"}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
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`
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const StyledCalendar = styled.div`
|
|
10
3
|
display: flex;
|
|
11
4
|
width: 100%;
|
|
12
5
|
`;
|
|
13
|
-
const StyledCalendarIconWrapper =
|
|
6
|
+
export const StyledCalendarIconWrapper = styled.div`
|
|
14
7
|
cursor: pointer;
|
|
15
8
|
z-index: 2;
|
|
16
9
|
`;
|
|
17
|
-
const StyledCalendarIconWrapperPseudo =
|
|
10
|
+
export const StyledCalendarIconWrapperPseudo = styled.div`
|
|
18
11
|
width: 15px;
|
|
19
12
|
`;
|
|
20
13
|
//# sourceMappingURL=Calendar.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.styles.js","names":["
|
|
1
|
+
{"version":3,"file":"Calendar.styles.js","names":["styled","StyledCalendar","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,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,cAAc,GAAGD,MAAM,CAACE,GAAI;AACzC;AACA;AACA,CAAC;AAED,OAAO,MAAMC,yBAAyB,GAAGH,MAAM,CAACE,GAAI;AACpD;AACA;AACA,CAAC;AAED,OAAO,MAAME,+BAA+B,GAAGJ,MAAM,CAACE,GAAI;AAC1D;AACA,CAAC"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _MonthWrapper = require("./MonthWrapper.styles");
|
|
9
|
-
var _Month = _interopRequireDefault(require("./month/Month"));
|
|
10
|
-
var _calendar = require("../../../utils/calendar");
|
|
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 && Object.prototype.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; }
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';
|
|
3
|
+
import Month from './month/Month';
|
|
4
|
+
import { getMonthAndYear, getNewDate } from '../../../utils/calendar';
|
|
14
5
|
const MonthWrapper = _ref => {
|
|
15
6
|
let {
|
|
16
7
|
locale,
|
|
@@ -24,19 +15,19 @@ const MonthWrapper = _ref => {
|
|
|
24
15
|
shouldRenderTwo,
|
|
25
16
|
width
|
|
26
17
|
} = _ref;
|
|
27
|
-
const [content, setContent] =
|
|
28
|
-
|
|
18
|
+
const [content, setContent] = useState();
|
|
19
|
+
useEffect(() => {
|
|
29
20
|
setContent(prevState => {
|
|
30
21
|
// Initial render of months
|
|
31
22
|
if (!prevState) {
|
|
32
23
|
const items = [];
|
|
33
24
|
for (let i = -1; i < 3; i++) {
|
|
34
|
-
const date =
|
|
25
|
+
const date = getNewDate(i, currentDate);
|
|
35
26
|
const {
|
|
36
27
|
month,
|
|
37
28
|
year
|
|
38
|
-
} =
|
|
39
|
-
items.push( /*#__PURE__*/
|
|
29
|
+
} = getMonthAndYear(date);
|
|
30
|
+
items.push( /*#__PURE__*/React.createElement(Month, {
|
|
40
31
|
key: `${month}-${year}`,
|
|
41
32
|
month: month,
|
|
42
33
|
year: year,
|
|
@@ -50,12 +41,12 @@ const MonthWrapper = _ref => {
|
|
|
50
41
|
return items;
|
|
51
42
|
}
|
|
52
43
|
if (direction === 'left') {
|
|
53
|
-
const date =
|
|
44
|
+
const date = getNewDate(-1, currentDate);
|
|
54
45
|
const {
|
|
55
46
|
month,
|
|
56
47
|
year
|
|
57
|
-
} =
|
|
58
|
-
prevState.unshift( /*#__PURE__*/
|
|
48
|
+
} = getMonthAndYear(date);
|
|
49
|
+
prevState.unshift( /*#__PURE__*/React.createElement(Month, {
|
|
59
50
|
key: `${month}-${year}`,
|
|
60
51
|
month: month,
|
|
61
52
|
year: year,
|
|
@@ -68,12 +59,12 @@ const MonthWrapper = _ref => {
|
|
|
68
59
|
prevState.pop();
|
|
69
60
|
}
|
|
70
61
|
if (direction === 'right') {
|
|
71
|
-
const date =
|
|
62
|
+
const date = getNewDate(2, currentDate);
|
|
72
63
|
const {
|
|
73
64
|
month,
|
|
74
65
|
year
|
|
75
|
-
} =
|
|
76
|
-
prevState.push( /*#__PURE__*/
|
|
66
|
+
} = getMonthAndYear(date);
|
|
67
|
+
prevState.push( /*#__PURE__*/React.createElement(Month, {
|
|
77
68
|
key: `${month}-${year}`,
|
|
78
69
|
month: month,
|
|
79
70
|
year: year,
|
|
@@ -88,7 +79,7 @@ const MonthWrapper = _ref => {
|
|
|
88
79
|
return prevState;
|
|
89
80
|
});
|
|
90
81
|
}, [categories, currentDate, direction, highlightedDates, locale, onSelect, selectedDate]);
|
|
91
|
-
const animate =
|
|
82
|
+
const animate = useMemo(() => {
|
|
92
83
|
if (shouldRenderTwo) {
|
|
93
84
|
switch (true) {
|
|
94
85
|
case direction === 'left':
|
|
@@ -121,9 +112,9 @@ const MonthWrapper = _ref => {
|
|
|
121
112
|
}
|
|
122
113
|
}
|
|
123
114
|
}, [direction, shouldRenderTwo]);
|
|
124
|
-
return /*#__PURE__*/
|
|
115
|
+
return /*#__PURE__*/React.createElement(StyledMonthWrapper, {
|
|
125
116
|
height: shouldRenderTwo ? width / 2 : width
|
|
126
|
-
}, /*#__PURE__*/
|
|
117
|
+
}, /*#__PURE__*/React.createElement(StyledMotionWrapper, {
|
|
127
118
|
animate: animate,
|
|
128
119
|
transition: {
|
|
129
120
|
type: 'tween',
|
|
@@ -133,5 +124,5 @@ const MonthWrapper = _ref => {
|
|
|
133
124
|
}, content));
|
|
134
125
|
};
|
|
135
126
|
MonthWrapper.displayName = 'MonthWrapper';
|
|
136
|
-
|
|
127
|
+
export default MonthWrapper;
|
|
137
128
|
//# sourceMappingURL=MonthWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthWrapper.js","names":["_react","_interopRequireWildcard","require","_MonthWrapper","_Month","_interopRequireDefault","_calendar","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","MonthWrapper","_ref","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","content","setContent","useState","useEffect","prevState","items","date","getNewDate","month","year","getMonthAndYear","push","createElement","key","unshift","pop","shift","animate","useMemo","x","StyledMonthWrapper","height","StyledMotionWrapper","transition","type","duration","onAnimationComplete","displayName","_default","exports"],"sources":["../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import React, { FC, type ReactElement, useEffect, useMemo, useState } from 'react';\nimport type { Locale } from 'date-fns';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\nimport type { MotionProps } from 'framer-motion';\nimport type { Categories, HighlightedDates } from '../../../types/calendar';\nimport Month from './month/Month';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\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\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 }, [categories, currentDate, direction, highlightedDates, locale, onSelect, 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\nMonthWrap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AAA,CAAA7D,OAAA,GAE3BoB,YAAY"}
|
|
1
|
+
{"version":3,"file":"MonthWrapper.js","names":["React","useEffect","useMemo","useState","StyledMonthWrapper","StyledMotionWrapper","Month","getMonthAndYear","getNewDate","MonthWrapper","_ref","locale","currentDate","highlightedDates","selectedDate","onSelect","categories","direction","onAnimationFinished","shouldRenderTwo","width","content","setContent","prevState","items","i","date","month","year","push","createElement","key","unshift","pop","shift","animate","x","height","transition","type","duration","onAnimationComplete","displayName"],"sources":["../../../../src/components/calendar/month-wrapper/MonthWrapper.tsx"],"sourcesContent":["import React, { FC, type ReactElement, useEffect, useMemo, useState } from 'react';\nimport type { Locale } from 'date-fns';\nimport { StyledMonthWrapper, StyledMotionWrapper } from './MonthWrapper.styles';\nimport type { MotionProps } from 'framer-motion';\nimport type { Categories, HighlightedDates } from '../../../types/calendar';\nimport Month from './month/Month';\nimport { getMonthAndYear, getNewDate } from '../../../utils/calendar';\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\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 }, [categories, currentDate, direction, highlightedDates, locale, onSelect, 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":"AAAA,OAAOA,KAAK,IAA2BC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAElF,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,uBAAuB;AAG/E,OAAOC,KAAK,MAAM,eAAe;AACjC,SAASC,eAAe,EAAEC,UAAU,QAAQ,yBAAyB;AAerE,MAAMC,YAAmC,GAAGC,IAAA,IAWtC;EAAA,IAXuC;IACzCC,MAAM;IAC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AAEA,CAAC,EAAE;UAAO,CAAC;MAC5B;IACJ,CAAC,MAAM;MACH,QAAQ,IAAI;QACR,KAAKnB,SAAS,KAAK,MAAM;UACrB,OAAO;YAAEmB,CAAC,EAAE;UAAK,CAAC;QACtB,KAAKnB,SAAS,KAAK,OAAO;UACtB,OAAO;YAAEmB,CAAC,EAAE;UAAQ,CAAC;QACzB;UACI,OAAO;YAAEA,CAAC,EAAE;UAAQ,CAAC;MAC7B;IACJ;EACJ,CAAC,EAAE,CAACnB,SAAS,EAAEE,eAAe,CAAC,CAAC;EAEhC,oBACInB,KAAA,CAAA8B,aAAA,CAAC1B,kBAAkB;IAACiC,MAAM,EAAElB,eAAe,GAAGC,KAAK,GAAG,CAAC,GAAGA;EAAM,gBAC5DpB,KAAA,CAAA8B,aAAA,CAACzB,mBAAmB;IAChB8B,OAAO,EAAEA,OAAQ;IACjBG,UAAU,EAAE;MACRC,IAAI,EAAE,OAAO;MACbC,QAAQ,EAAE,CAACvB,SAAS,GAAG,CAAC,GAAG;IAC/B,CAAE;IACFwB,mBAAmB,EAAEvB;EAAoB,GAExCG,OACgB,CACL,CAAC;AAE7B,CAAC;AAEDZ,YAAY,CAACiC,WAAW,GAAG,cAAc;AAEzC,eAAejC,YAAY"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.StyledMotionWrapper = exports.StyledMonthWrapper = void 0;
|
|
7
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
-
var _framerMotion = require("framer-motion");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const StyledMonthWrapper = exports.StyledMonthWrapper = _styledComponents.default.div`
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
export const StyledMonthWrapper = styled.div`
|
|
11
4
|
width: 100%;
|
|
12
5
|
overflow-x: clip;
|
|
13
6
|
height: ${_ref => {
|
|
@@ -17,7 +10,7 @@ const StyledMonthWrapper = exports.StyledMonthWrapper = _styledComponents.defaul
|
|
|
17
10
|
return height;
|
|
18
11
|
}}px;
|
|
19
12
|
`;
|
|
20
|
-
const StyledMotionWrapper =
|
|
13
|
+
export const StyledMotionWrapper = styled(motion.div)`
|
|
21
14
|
display: flex;
|
|
22
15
|
height: 100%;
|
|
23
16
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthWrapper.styles.js","names":["
|
|
1
|
+
{"version":3,"file":"MonthWrapper.styles.js","names":["styled","motion","StyledMonthWrapper","div","_ref","height","StyledMotionWrapper"],"sources":["../../../../src/components/calendar/month-wrapper/MonthWrapper.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { motion } from 'framer-motion';\nimport type { WithTheme } from '@chayns-components/core';\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":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,MAAM,QAAQ,eAAe;AAKtC,OAAO,MAAMC,kBAAkB,GAAGF,MAAM,CAACG,GAA6B;AACtE;AACA;AACA,cAAcC,IAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAAA,OAAKC,MAAM;AAAA,CAAC;AACrC,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAGN,MAAM,CAACC,MAAM,CAACE,GAAG,CAAE;AACtD;AACA;AACA,CAAC"}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 && Object.prototype.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; }
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { StyledMonth, StyledMonthHead, StyledMonthName } from './Month.styles';
|
|
3
|
+
import WeekdayWrapper from './weekday-wrapper/WeekdayWrapper';
|
|
4
|
+
import DayWrapper from './day-wrapper/DayWrapper';
|
|
5
|
+
import { formatMonth } from '../../../../utils/calendar';
|
|
15
6
|
const Month = _ref => {
|
|
16
7
|
let {
|
|
17
8
|
month,
|
|
@@ -22,13 +13,13 @@ const Month = _ref => {
|
|
|
22
13
|
onSelect,
|
|
23
14
|
categories
|
|
24
15
|
} = _ref;
|
|
25
|
-
const [currentYear] =
|
|
26
|
-
return /*#__PURE__*/
|
|
16
|
+
const [currentYear] = useState(new Date().getFullYear());
|
|
17
|
+
return /*#__PURE__*/React.createElement(StyledMonth, null, /*#__PURE__*/React.createElement(StyledMonthHead, null, /*#__PURE__*/React.createElement(StyledMonthName, null, `${formatMonth({
|
|
27
18
|
locale,
|
|
28
19
|
month
|
|
29
|
-
})} ${String(currentYear) !== year ? year : ''}`)), /*#__PURE__*/
|
|
20
|
+
})} ${String(currentYear) !== year ? year : ''}`)), /*#__PURE__*/React.createElement(WeekdayWrapper, {
|
|
30
21
|
locale: locale
|
|
31
|
-
}), /*#__PURE__*/
|
|
22
|
+
}), /*#__PURE__*/React.createElement(DayWrapper, {
|
|
32
23
|
key: `day-wrapper-${month}`,
|
|
33
24
|
categories: categories,
|
|
34
25
|
selectedDate: selectedDate,
|
|
@@ -39,5 +30,5 @@ const Month = _ref => {
|
|
|
39
30
|
}));
|
|
40
31
|
};
|
|
41
32
|
Month.displayName = 'Month';
|
|
42
|
-
|
|
33
|
+
export default Month;
|
|
43
34
|
//# sourceMappingURL=Month.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Month.js","names":["
|
|
1
|
+
{"version":3,"file":"Month.js","names":["React","useState","StyledMonth","StyledMonthHead","StyledMonthName","WeekdayWrapper","DayWrapper","formatMonth","Month","_ref","month","year","locale","highlightedDates","selectedDate","onSelect","categories","currentYear","Date","getFullYear","createElement","String","key","displayName"],"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,OAAOA,KAAK,IAAQC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,WAAW,EAAEC,eAAe,EAAEC,eAAe,QAAQ,gBAAgB;AAC9E,OAAOC,cAAc,MAAM,kCAAkC;AAC7D,OAAOC,UAAU,MAAM,0BAA0B;AAGjD,SAASC,WAAW,QAAQ,4BAA4B;AAYxD,MAAMC,KAAqB,GAAGC,IAAA,IAQxB;EAAA,IARyB;IAC3BC,KAAK;IACLC,IAAI;IACJC,MAAM;IACNC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC;EACJ,CAAC,GAAAP,IAAA;EACG,MAAM,CAACQ,WAAW,CAAC,GAAGhB,QAAQ,CAAC,IAAIiB,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC;EAExD,oBACInB,KAAA,CAAAoB,aAAA,CAAClB,WAAW,qBACRF,KAAA,CAAAoB,aAAA,CAACjB,eAAe,qBACZH,KAAA,CAAAoB,aAAA,CAAChB,eAAe,QAAG,GAAEG,WAAW,CAAC;IAAEK,MAAM;IAAEF;EAAM,CAAC,CAAE,IAAGW,MAAM,CAACJ,WAAW,CAAC,KAAKN,IAAI,GAAGA,IAAI,GAAG,EAAG,EAAmB,CACtG,CAAC,eAClBX,KAAA,CAAAoB,aAAA,CAACf,cAAc;IAACO,MAAM,EAAEA;EAAO,CAAE,CAAC,eAClCZ,KAAA,CAAAoB,aAAA,CAACd,UAAU;IACPgB,GAAG,EAAG,eAAcZ,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;AAEDL,KAAK,CAACe,WAAW,GAAG,OAAO;AAE3B,eAAef,KAAK"}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
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`
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const StyledMonth = styled.div`
|
|
10
3
|
height: 100%;
|
|
11
4
|
aspect-ratio: 1;
|
|
12
5
|
`;
|
|
13
|
-
const StyledMonthHead =
|
|
6
|
+
export const StyledMonthHead = styled.div`
|
|
14
7
|
display: flex;
|
|
15
8
|
align-items: center;
|
|
16
9
|
`;
|
|
17
|
-
const StyledMonthName =
|
|
10
|
+
export const StyledMonthName = styled.div`
|
|
18
11
|
font-weight: bold;
|
|
19
12
|
width: 100%;
|
|
20
13
|
text-align: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Month.styles.js","names":["
|
|
1
|
+
{"version":3,"file":"Month.styles.js","names":["styled","StyledMonth","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,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,WAAW,GAAGD,MAAM,CAACE,GAAI;AACtC;AACA;AACA,CAAC;AAED,OAAO,MAAMC,eAAe,GAAGH,MAAM,CAACE,GAAI;AAC1C;AACA;AACA,CAAC;AAED,OAAO,MAAME,eAAe,GAAGJ,MAAM,CAACE,GAAI;AAC1C;AACA;AACA;AACA;AACA,CAAC"}
|