@mantine/dates 3.3.4 → 3.4.2
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/cjs/components/Calendar/Calendar.js +6 -137
- package/cjs/components/Calendar/Calendar.js.map +1 -1
- package/cjs/components/CalendarBase/CalendarBase.js +242 -0
- package/cjs/components/CalendarBase/CalendarBase.js.map +1 -0
- package/cjs/components/CalendarBase/CalendarBase.styles.js +22 -0
- package/cjs/components/CalendarBase/CalendarBase.styles.js.map +1 -0
- package/cjs/components/{Calendar → CalendarBase/CalendarHeader}/ArrowIcon.js +0 -0
- package/cjs/components/CalendarBase/CalendarHeader/ArrowIcon.js.map +1 -0
- package/cjs/components/CalendarBase/CalendarHeader/CalendarHeader.js +119 -0
- package/cjs/components/CalendarBase/CalendarHeader/CalendarHeader.js.map +1 -0
- package/cjs/components/CalendarBase/CalendarHeader/CalendarHeader.styles.js +58 -0
- package/cjs/components/CalendarBase/CalendarHeader/CalendarHeader.styles.js.map +1 -0
- package/cjs/components/CalendarBase/MonthPicker/MonthPicker.js +113 -0
- package/cjs/components/CalendarBase/MonthPicker/MonthPicker.js.map +1 -0
- package/cjs/components/CalendarBase/MonthPicker/MonthPicker.styles.js +52 -0
- package/cjs/components/CalendarBase/MonthPicker/MonthPicker.styles.js.map +1 -0
- package/cjs/components/CalendarBase/MonthPicker/is-month-in-range/is-month-in-range.js +25 -0
- package/cjs/components/CalendarBase/MonthPicker/is-month-in-range/is-month-in-range.js.map +1 -0
- package/cjs/components/CalendarBase/MonthsList/MonthsList.js +123 -0
- package/cjs/components/CalendarBase/MonthsList/MonthsList.js.map +1 -0
- package/cjs/components/CalendarBase/MonthsList/format-month-label/format-month-label.js +17 -0
- package/cjs/components/CalendarBase/MonthsList/format-month-label/format-month-label.js.map +1 -0
- package/cjs/components/CalendarBase/YearPicker/YearPicker.js +102 -0
- package/cjs/components/CalendarBase/YearPicker/YearPicker.js.map +1 -0
- package/cjs/components/CalendarBase/YearPicker/YearPicker.styles.js +54 -0
- package/cjs/components/CalendarBase/YearPicker/YearPicker.styles.js.map +1 -0
- package/cjs/components/CalendarBase/YearPicker/get-decade-range/get-decade-range.js +16 -0
- package/cjs/components/CalendarBase/YearPicker/get-decade-range/get-decade-range.js.map +1 -0
- package/cjs/components/DatePicker/DatePicker.js +10 -10
- package/cjs/components/DatePicker/DatePicker.js.map +1 -1
- package/cjs/components/DatePickerBase/DatePickerBase.js +5 -5
- package/cjs/components/DatePickerBase/DatePickerBase.js.map +1 -1
- package/cjs/components/DateRangePicker/DateRangePicker.js +0 -6
- package/cjs/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/cjs/components/Month/Day/Day.js +12 -15
- package/cjs/components/Month/Day/Day.js.map +1 -1
- package/cjs/components/Month/Day/Day.styles.js +2 -1
- package/cjs/components/Month/Day/Day.styles.js.map +1 -1
- package/cjs/components/Month/Day/get-day-autofocus/get-day-autofocus.js +13 -0
- package/cjs/components/Month/Day/get-day-autofocus/get-day-autofocus.js.map +1 -0
- package/cjs/components/Month/Day/get-day-tab-index/get-day-tab-index.js +16 -0
- package/cjs/components/Month/Day/get-day-tab-index/get-day-tab-index.js.map +1 -0
- package/cjs/components/Month/Month.js +36 -67
- package/cjs/components/Month/Month.js.map +1 -1
- package/cjs/components/Month/Month.styles.js +1 -1
- package/cjs/components/Month/Month.styles.js.map +1 -1
- package/cjs/components/Month/get-day-props/get-day-props.js +9 -24
- package/cjs/components/Month/get-day-props/get-day-props.js.map +1 -1
- package/cjs/components/Month/get-day-props/get-range-props/get-range-props.js +25 -0
- package/cjs/components/Month/get-day-props/get-range-props/get-range-props.js.map +1 -0
- package/cjs/components/Month/get-day-props/is-disabled/is-disabled.js +27 -0
- package/cjs/components/Month/get-day-props/is-disabled/is-disabled.js.map +1 -0
- package/cjs/components/Month/get-day-props/is-outside/is-outside.js +13 -0
- package/cjs/components/Month/get-day-props/is-outside/is-outside.js.map +1 -0
- package/cjs/components/Month/get-day-props/is-weekend/is-weekend.js +11 -0
- package/cjs/components/Month/get-day-props/is-weekend/is-weekend.js.map +1 -0
- package/cjs/components/RangeCalendar/RangeCalendar.js +19 -122
- package/cjs/components/RangeCalendar/RangeCalendar.js.map +1 -1
- package/cjs/components/TimeInput/TimeField/TimeField.js +6 -1
- package/cjs/components/TimeInput/TimeField/TimeField.js.map +1 -1
- package/cjs/components/TimeInput/TimeField/TimeField.styles.js +54 -0
- package/cjs/components/TimeInput/TimeField/TimeField.styles.js.map +1 -0
- package/cjs/components/TimeInput/TimeInput.styles.js +1 -24
- package/cjs/components/TimeInput/TimeInput.styles.js.map +1 -1
- package/cjs/components/TimeRangeInput/TimeRangeInput.styles.js +2 -19
- package/cjs/components/TimeRangeInput/TimeRangeInput.styles.js.map +1 -1
- package/cjs/utils/get-months-names/get-months-names.js +2 -2
- package/cjs/utils/get-months-names/get-months-names.js.map +1 -1
- package/esm/components/Calendar/Calendar.js +6 -136
- package/esm/components/Calendar/Calendar.js.map +1 -1
- package/esm/components/CalendarBase/CalendarBase.js +234 -0
- package/esm/components/CalendarBase/CalendarBase.js.map +1 -0
- package/esm/components/CalendarBase/CalendarBase.styles.js +18 -0
- package/esm/components/CalendarBase/CalendarBase.styles.js.map +1 -0
- package/esm/components/{Calendar → CalendarBase/CalendarHeader}/ArrowIcon.js +0 -0
- package/esm/components/CalendarBase/CalendarHeader/ArrowIcon.js.map +1 -0
- package/esm/components/CalendarBase/CalendarHeader/CalendarHeader.js +111 -0
- package/esm/components/CalendarBase/CalendarHeader/CalendarHeader.js.map +1 -0
- package/esm/components/CalendarBase/CalendarHeader/CalendarHeader.styles.js +54 -0
- package/esm/components/CalendarBase/CalendarHeader/CalendarHeader.styles.js.map +1 -0
- package/esm/components/CalendarBase/MonthPicker/MonthPicker.js +105 -0
- package/esm/components/CalendarBase/MonthPicker/MonthPicker.js.map +1 -0
- package/esm/components/CalendarBase/MonthPicker/MonthPicker.styles.js +48 -0
- package/esm/components/CalendarBase/MonthPicker/MonthPicker.styles.js.map +1 -0
- package/esm/components/CalendarBase/MonthPicker/is-month-in-range/is-month-in-range.js +17 -0
- package/esm/components/CalendarBase/MonthPicker/is-month-in-range/is-month-in-range.js.map +1 -0
- package/esm/components/CalendarBase/MonthsList/MonthsList.js +114 -0
- package/esm/components/CalendarBase/MonthsList/MonthsList.js.map +1 -0
- package/esm/components/CalendarBase/MonthsList/format-month-label/format-month-label.js +9 -0
- package/esm/components/CalendarBase/MonthsList/format-month-label/format-month-label.js.map +1 -0
- package/esm/components/CalendarBase/YearPicker/YearPicker.js +94 -0
- package/esm/components/CalendarBase/YearPicker/YearPicker.js.map +1 -0
- package/esm/components/CalendarBase/YearPicker/YearPicker.styles.js +50 -0
- package/esm/components/CalendarBase/YearPicker/YearPicker.styles.js.map +1 -0
- package/esm/components/CalendarBase/YearPicker/get-decade-range/get-decade-range.js +12 -0
- package/esm/components/CalendarBase/YearPicker/get-decade-range/get-decade-range.js.map +1 -0
- package/esm/components/DatePicker/DatePicker.js +10 -10
- package/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/esm/components/DatePickerBase/DatePickerBase.js +6 -6
- package/esm/components/DatePickerBase/DatePickerBase.js.map +1 -1
- package/esm/components/DateRangePicker/DateRangePicker.js +0 -6
- package/esm/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/esm/components/Month/Day/Day.js +12 -15
- package/esm/components/Month/Day/Day.js.map +1 -1
- package/esm/components/Month/Day/Day.styles.js +2 -1
- package/esm/components/Month/Day/Day.styles.js.map +1 -1
- package/esm/components/Month/Day/get-day-autofocus/get-day-autofocus.js +9 -0
- package/esm/components/Month/Day/get-day-autofocus/get-day-autofocus.js.map +1 -0
- package/esm/components/Month/Day/get-day-tab-index/get-day-tab-index.js +12 -0
- package/esm/components/Month/Day/get-day-tab-index/get-day-tab-index.js.map +1 -0
- package/esm/components/Month/Month.js +38 -69
- package/esm/components/Month/Month.js.map +1 -1
- package/esm/components/Month/Month.styles.js +1 -1
- package/esm/components/Month/Month.styles.js.map +1 -1
- package/esm/components/Month/get-day-props/get-day-props.js +9 -20
- package/esm/components/Month/get-day-props/get-day-props.js.map +1 -1
- package/esm/components/Month/get-day-props/get-range-props/get-range-props.js +17 -0
- package/esm/components/Month/get-day-props/get-range-props/get-range-props.js.map +1 -0
- package/esm/components/Month/get-day-props/is-disabled/is-disabled.js +19 -0
- package/esm/components/Month/get-day-props/is-disabled/is-disabled.js.map +1 -0
- package/esm/components/Month/get-day-props/is-outside/is-outside.js +9 -0
- package/esm/components/Month/get-day-props/is-outside/is-outside.js.map +1 -0
- package/esm/components/Month/get-day-props/is-weekend/is-weekend.js +7 -0
- package/esm/components/Month/get-day-props/is-weekend/is-weekend.js.map +1 -0
- package/esm/components/RangeCalendar/RangeCalendar.js +20 -123
- package/esm/components/RangeCalendar/RangeCalendar.js.map +1 -1
- package/esm/components/TimeInput/TimeField/TimeField.js +6 -1
- package/esm/components/TimeInput/TimeField/TimeField.js.map +1 -1
- package/esm/components/TimeInput/TimeField/TimeField.styles.js +50 -0
- package/esm/components/TimeInput/TimeField/TimeField.styles.js.map +1 -0
- package/esm/components/TimeInput/TimeInput.styles.js +1 -24
- package/esm/components/TimeInput/TimeInput.styles.js.map +1 -1
- package/esm/components/TimeRangeInput/TimeRangeInput.styles.js +2 -19
- package/esm/components/TimeRangeInput/TimeRangeInput.styles.js.map +1 -1
- package/esm/utils/get-months-names/get-months-names.js +2 -2
- package/esm/utils/get-months-names/get-months-names.js.map +1 -1
- package/lib/components/Calendar/Calendar.d.ts +3 -45
- package/lib/components/Calendar/Calendar.d.ts.map +1 -1
- package/lib/components/Calendar/index.d.ts +1 -1
- package/lib/components/Calendar/index.d.ts.map +1 -1
- package/lib/components/CalendarBase/CalendarBase.d.ts +56 -0
- package/lib/components/CalendarBase/CalendarBase.d.ts.map +1 -0
- package/lib/components/CalendarBase/CalendarBase.styles.d.ts +13 -0
- package/lib/components/CalendarBase/CalendarBase.styles.d.ts.map +1 -0
- package/lib/components/CalendarBase/CalendarHeader/ArrowIcon.d.ts +10 -0
- package/lib/components/CalendarBase/CalendarHeader/ArrowIcon.d.ts.map +1 -0
- package/lib/components/CalendarBase/CalendarHeader/CalendarHeader.d.ts +24 -0
- package/lib/components/CalendarBase/CalendarHeader/CalendarHeader.d.ts.map +1 -0
- package/lib/components/CalendarBase/CalendarHeader/CalendarHeader.styles.d.ts +18 -0
- package/lib/components/CalendarBase/CalendarHeader/CalendarHeader.styles.d.ts.map +1 -0
- package/lib/components/CalendarBase/MonthPicker/MonthPicker.d.ts +27 -0
- package/lib/components/CalendarBase/MonthPicker/MonthPicker.d.ts.map +1 -0
- package/lib/components/CalendarBase/MonthPicker/MonthPicker.styles.d.ts +11 -0
- package/lib/components/CalendarBase/MonthPicker/MonthPicker.styles.d.ts.map +1 -0
- package/lib/components/CalendarBase/MonthPicker/is-month-in-range/is-month-in-range.d.ts +8 -0
- package/lib/components/CalendarBase/MonthPicker/is-month-in-range/is-month-in-range.d.ts.map +1 -0
- package/lib/components/CalendarBase/MonthsList/MonthsList.d.ts +24 -0
- package/lib/components/CalendarBase/MonthsList/MonthsList.d.ts.map +1 -0
- package/lib/components/CalendarBase/MonthsList/format-month-label/format-month-label.d.ts +8 -0
- package/lib/components/CalendarBase/MonthsList/format-month-label/format-month-label.d.ts.map +1 -0
- package/lib/components/CalendarBase/YearPicker/YearPicker.d.ts +20 -0
- package/lib/components/CalendarBase/YearPicker/YearPicker.d.ts.map +1 -0
- package/lib/components/CalendarBase/YearPicker/YearPicker.styles.d.ts +11 -0
- package/lib/components/CalendarBase/YearPicker/YearPicker.styles.d.ts.map +1 -0
- package/lib/components/CalendarBase/YearPicker/get-decade-range/get-decade-range.d.ts +2 -0
- package/lib/components/CalendarBase/YearPicker/get-decade-range/get-decade-range.d.ts.map +1 -0
- package/lib/components/DatePicker/DatePicker.d.ts +2 -2
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/components/DatePickerBase/DatePickerBase.d.ts +2 -2
- package/lib/components/DatePickerBase/DatePickerBase.d.ts.map +1 -1
- package/lib/components/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/lib/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/lib/components/Month/Day/Day.d.ts +3 -3
- package/lib/components/Month/Day/Day.d.ts.map +1 -1
- package/lib/components/Month/Day/Day.styles.d.ts +3 -2
- package/lib/components/Month/Day/Day.styles.d.ts.map +1 -1
- package/lib/components/Month/Day/get-day-autofocus/get-day-autofocus.d.ts +8 -0
- package/lib/components/Month/Day/get-day-autofocus/get-day-autofocus.d.ts.map +1 -0
- package/lib/components/Month/Day/get-day-tab-index/get-day-tab-index.d.ts +9 -0
- package/lib/components/Month/Day/get-day-tab-index/get-day-tab-index.d.ts.map +1 -0
- package/lib/components/Month/Month.d.ts +12 -11
- package/lib/components/Month/Month.d.ts.map +1 -1
- package/lib/components/Month/Month.styles.d.ts +2 -2
- package/lib/components/Month/get-day-props/get-day-props.d.ts +2 -27
- package/lib/components/Month/get-day-props/get-day-props.d.ts.map +1 -1
- package/lib/components/Month/get-day-props/get-range-props/get-range-props.d.ts +7 -0
- package/lib/components/Month/get-day-props/get-range-props/get-range-props.d.ts.map +1 -0
- package/lib/components/Month/get-day-props/is-disabled/is-disabled.d.ts +11 -0
- package/lib/components/Month/get-day-props/is-disabled/is-disabled.d.ts.map +1 -0
- package/lib/components/Month/get-day-props/is-outside/is-outside.d.ts +2 -0
- package/lib/components/Month/get-day-props/is-outside/is-outside.d.ts.map +1 -0
- package/lib/components/Month/get-day-props/is-weekend/is-weekend.d.ts +2 -0
- package/lib/components/Month/get-day-props/is-weekend/is-weekend.d.ts.map +1 -0
- package/lib/components/Month/index.d.ts +1 -0
- package/lib/components/Month/index.d.ts.map +1 -1
- package/lib/components/Month/types.d.ts +23 -0
- package/lib/components/Month/types.d.ts.map +1 -0
- package/lib/components/RangeCalendar/RangeCalendar.d.ts +2 -12
- package/lib/components/RangeCalendar/RangeCalendar.d.ts.map +1 -1
- package/lib/components/TimeInput/TimeField/TimeField.d.ts.map +1 -1
- package/lib/components/TimeInput/TimeField/TimeField.styles.d.ts +18 -0
- package/lib/components/TimeInput/TimeField/TimeField.styles.d.ts.map +1 -0
- package/lib/components/TimeInput/TimeInput.styles.d.ts +0 -7
- package/lib/components/TimeInput/TimeInput.styles.d.ts.map +1 -1
- package/lib/components/TimeRangeInput/TimeRangeInput.styles.d.ts +2 -2
- package/lib/components/TimeRangeInput/TimeRangeInput.styles.d.ts.map +1 -1
- package/lib/utils/get-months-names/get-months-names.d.ts +1 -1
- package/lib/utils/get-months-names/get-months-names.d.ts.map +1 -1
- package/package.json +3 -3
- package/cjs/components/Calendar/ArrowIcon.js.map +0 -1
- package/cjs/components/Calendar/CalendarHeader/CalendarHeader.js +0 -105
- package/cjs/components/Calendar/CalendarHeader/CalendarHeader.js.map +0 -1
- package/cjs/components/Calendar/CalendarLabel/CalendarLabel.js +0 -69
- package/cjs/components/Calendar/CalendarLabel/CalendarLabel.js.map +0 -1
- package/cjs/components/Calendar/CalendarLabel/CalendarLabel.styles.js +0 -14
- package/cjs/components/Calendar/CalendarLabel/CalendarLabel.styles.js.map +0 -1
- package/cjs/components/Calendar/CalendarWrapper/CalendarWrapper.js +0 -58
- package/cjs/components/Calendar/CalendarWrapper/CalendarWrapper.js.map +0 -1
- package/cjs/components/Calendar/get-disabled-state/get-disabled-state.js +0 -18
- package/cjs/components/Calendar/get-disabled-state/get-disabled-state.js.map +0 -1
- package/esm/components/Calendar/ArrowIcon.js.map +0 -1
- package/esm/components/Calendar/CalendarHeader/CalendarHeader.js +0 -97
- package/esm/components/Calendar/CalendarHeader/CalendarHeader.js.map +0 -1
- package/esm/components/Calendar/CalendarLabel/CalendarLabel.js +0 -60
- package/esm/components/Calendar/CalendarLabel/CalendarLabel.js.map +0 -1
- package/esm/components/Calendar/CalendarLabel/CalendarLabel.styles.js +0 -10
- package/esm/components/Calendar/CalendarLabel/CalendarLabel.styles.js.map +0 -1
- package/esm/components/Calendar/CalendarWrapper/CalendarWrapper.js +0 -50
- package/esm/components/Calendar/CalendarWrapper/CalendarWrapper.js.map +0 -1
- package/esm/components/Calendar/get-disabled-state/get-disabled-state.js +0 -10
- package/esm/components/Calendar/get-disabled-state/get-disabled-state.js.map +0 -1
- package/lib/components/Calendar/CalendarHeader/CalendarHeader.d.ts +0 -33
- package/lib/components/Calendar/CalendarHeader/CalendarHeader.d.ts.map +0 -1
- package/lib/components/Calendar/CalendarLabel/CalendarLabel.d.ts +0 -26
- package/lib/components/Calendar/CalendarLabel/CalendarLabel.d.ts.map +0 -1
- package/lib/components/Calendar/CalendarLabel/CalendarLabel.styles.d.ts +0 -7
- package/lib/components/Calendar/CalendarLabel/CalendarLabel.styles.d.ts.map +0 -1
- package/lib/components/Calendar/CalendarWrapper/CalendarWrapper.d.ts +0 -10
- package/lib/components/Calendar/CalendarWrapper/CalendarWrapper.d.ts.map +0 -1
- package/lib/components/Calendar/get-disabled-state/get-disabled-state.d.ts +0 -15
- package/lib/components/Calendar/get-disabled-state/get-disabled-state.d.ts.map +0 -1
|
@@ -8,7 +8,7 @@ var hooks = require('@mantine/hooks');
|
|
|
8
8
|
var dayjs = require('dayjs');
|
|
9
9
|
var getMonthDays = require('../../utils/get-month-days/get-month-days.js');
|
|
10
10
|
var getWeekdaysNames = require('../../utils/get-weekdays-names/get-weekdays-names.js');
|
|
11
|
-
var
|
|
11
|
+
var isSameDate = require('../../utils/is-same-date/is-same-date.js');
|
|
12
12
|
var Day = require('./Day/Day.js');
|
|
13
13
|
var getDayProps = require('./get-day-props/get-day-props.js');
|
|
14
14
|
var Month_styles = require('./Month.styles.js');
|
|
@@ -48,19 +48,16 @@ var __objRest = (source, exclude) => {
|
|
|
48
48
|
};
|
|
49
49
|
const noop = () => {
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
const Month = React.forwardRef((_a, ref) => {
|
|
52
52
|
var _b = _a, {
|
|
53
53
|
className,
|
|
54
|
-
style,
|
|
55
54
|
month,
|
|
56
55
|
value,
|
|
57
56
|
onChange,
|
|
58
|
-
autoFocus = false,
|
|
59
57
|
disableOutsideEvents = false,
|
|
60
58
|
locale,
|
|
61
59
|
dayClassName,
|
|
62
60
|
dayStyle,
|
|
63
|
-
disableOutsideDayStyle = false,
|
|
64
61
|
classNames,
|
|
65
62
|
styles,
|
|
66
63
|
minDate,
|
|
@@ -73,20 +70,20 @@ function Month(_a) {
|
|
|
73
70
|
size = "sm",
|
|
74
71
|
fullWidth = false,
|
|
75
72
|
preventFocus = false,
|
|
76
|
-
|
|
77
|
-
firstDayOfWeek = "monday"
|
|
73
|
+
focusable = true,
|
|
74
|
+
firstDayOfWeek = "monday",
|
|
75
|
+
onDayKeyDown,
|
|
76
|
+
daysRefs,
|
|
77
|
+
hideOutsideDates = false
|
|
78
78
|
} = _b, others = __objRest(_b, [
|
|
79
79
|
"className",
|
|
80
|
-
"style",
|
|
81
80
|
"month",
|
|
82
81
|
"value",
|
|
83
82
|
"onChange",
|
|
84
|
-
"autoFocus",
|
|
85
83
|
"disableOutsideEvents",
|
|
86
84
|
"locale",
|
|
87
85
|
"dayClassName",
|
|
88
86
|
"dayStyle",
|
|
89
|
-
"disableOutsideDayStyle",
|
|
90
87
|
"classNames",
|
|
91
88
|
"styles",
|
|
92
89
|
"minDate",
|
|
@@ -99,51 +96,15 @@ function Month(_a) {
|
|
|
99
96
|
"size",
|
|
100
97
|
"fullWidth",
|
|
101
98
|
"preventFocus",
|
|
102
|
-
"
|
|
103
|
-
"firstDayOfWeek"
|
|
99
|
+
"focusable",
|
|
100
|
+
"firstDayOfWeek",
|
|
101
|
+
"onDayKeyDown",
|
|
102
|
+
"daysRefs",
|
|
103
|
+
"hideOutsideDates"
|
|
104
104
|
]);
|
|
105
|
-
const { classes, cx } = Month_styles['default']({ fullWidth }, {
|
|
106
|
-
const { mergedStyles, rest } = core.useExtractedMargins({ others, style });
|
|
107
|
-
const theme = core.useMantineTheme();
|
|
105
|
+
const { classes, cx, theme } = Month_styles['default']({ fullWidth }, { classNames, styles, name: __staticSelector });
|
|
108
106
|
const finalLocale = locale || theme.datesLocale;
|
|
109
|
-
const daysRefs = React.useRef({});
|
|
110
107
|
const days = getMonthDays.getMonthDays(month, firstDayOfWeek);
|
|
111
|
-
const focusDay = (date, diff) => {
|
|
112
|
-
const offset = new Date(date);
|
|
113
|
-
offset.setDate(date.getDate() + diff);
|
|
114
|
-
if (offset.toISOString() in daysRefs.current) {
|
|
115
|
-
if (!(!isSameMonth.isSameMonth(month, offset) && disableOutsideEvents)) {
|
|
116
|
-
daysRefs.current[offset.toISOString()].focus();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const handleKeyDown = (currentDate, event) => {
|
|
121
|
-
const { code } = event.nativeEvent;
|
|
122
|
-
if (code === "ArrowUp") {
|
|
123
|
-
event.preventDefault();
|
|
124
|
-
focusDay(currentDate, -7);
|
|
125
|
-
}
|
|
126
|
-
if (code === "ArrowDown") {
|
|
127
|
-
event.preventDefault();
|
|
128
|
-
focusDay(currentDate, 7);
|
|
129
|
-
}
|
|
130
|
-
if (code === "ArrowRight") {
|
|
131
|
-
event.preventDefault();
|
|
132
|
-
currentDate.getDay() !== 0 && focusDay(currentDate, 1);
|
|
133
|
-
}
|
|
134
|
-
if (code === "ArrowLeft") {
|
|
135
|
-
event.preventDefault();
|
|
136
|
-
currentDate.getDay() !== 1 && focusDay(currentDate, -1);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
React.useEffect(() => {
|
|
140
|
-
if (autoFocus) {
|
|
141
|
-
const date = new Date(month.getFullYear(), month.getMonth(), value ? value.getDate() : 1).toISOString();
|
|
142
|
-
if (date in daysRefs.current) {
|
|
143
|
-
daysRefs.current[date].focus();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}, []);
|
|
147
108
|
const weekdays = getWeekdaysNames.getWeekdaysNames(finalLocale, firstDayOfWeek).map((weekday) => /* @__PURE__ */ React__default.createElement("th", {
|
|
148
109
|
className: classes.weekdayCell,
|
|
149
110
|
key: weekday
|
|
@@ -166,46 +127,54 @@ function Month(_a) {
|
|
|
166
127
|
disableOutsideEvents,
|
|
167
128
|
range
|
|
168
129
|
});
|
|
169
|
-
const
|
|
130
|
+
const onKeyDownPayload = { rowIndex, cellIndex, date };
|
|
170
131
|
return /* @__PURE__ */ React__default.createElement("td", {
|
|
171
132
|
className: classes.cell,
|
|
172
133
|
key: cellIndex
|
|
173
134
|
}, /* @__PURE__ */ React__default.createElement(Day.Day, {
|
|
174
135
|
ref: (button) => {
|
|
175
|
-
daysRefs
|
|
136
|
+
if (daysRefs) {
|
|
137
|
+
if (!Array.isArray(daysRefs[rowIndex])) {
|
|
138
|
+
daysRefs[rowIndex] = [];
|
|
139
|
+
}
|
|
140
|
+
daysRefs[rowIndex][cellIndex] = button;
|
|
141
|
+
}
|
|
176
142
|
},
|
|
177
143
|
onClick: () => typeof onChange === "function" && onChange(date),
|
|
178
144
|
onMouseDown: (event) => preventFocus && event.preventDefault(),
|
|
179
145
|
value: date,
|
|
180
146
|
outside: dayProps.outside,
|
|
181
147
|
weekend: dayProps.weekend,
|
|
182
|
-
inRange: dayProps.inRange
|
|
148
|
+
inRange: dayProps.inRange,
|
|
183
149
|
firstInRange: dayProps.firstInRange,
|
|
184
150
|
lastInRange: dayProps.lastInRange,
|
|
185
|
-
firstInMonth: cellIndex === 0 && rowIndex === 0,
|
|
186
|
-
selected:
|
|
151
|
+
firstInMonth: hideOutsideDates ? isSameDate.isSameDate(date, dayjs__default(month).startOf("month").toDate()) : cellIndex === 0 && rowIndex === 0,
|
|
152
|
+
selected: dayProps.selected || dayProps.selectedInRange,
|
|
187
153
|
hasValue: hasValueInMonthRange,
|
|
188
|
-
onKeyDown:
|
|
154
|
+
onKeyDown: (event) => typeof onDayKeyDown === "function" && onDayKeyDown(onKeyDownPayload, event),
|
|
189
155
|
className: typeof dayClassName === "function" ? dayClassName(date, dayProps) : null,
|
|
190
156
|
style: typeof dayStyle === "function" ? dayStyle(date, dayProps) : null,
|
|
191
|
-
styles,
|
|
192
|
-
classNames,
|
|
193
157
|
disabled: dayProps.disabled,
|
|
194
|
-
__staticSelector,
|
|
195
158
|
onMouseEnter: typeof onDayMouseEnter === "function" ? onDayMouseEnter : noop,
|
|
196
159
|
size,
|
|
197
|
-
fullWidth
|
|
160
|
+
fullWidth,
|
|
161
|
+
focusable,
|
|
162
|
+
hideOutsideDates,
|
|
163
|
+
__staticSelector,
|
|
164
|
+
styles,
|
|
165
|
+
classNames
|
|
198
166
|
}));
|
|
199
167
|
});
|
|
200
168
|
return /* @__PURE__ */ React__default.createElement("tr", {
|
|
201
169
|
key: rowIndex
|
|
202
170
|
}, cells);
|
|
203
171
|
});
|
|
204
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
172
|
+
return /* @__PURE__ */ React__default.createElement(core.Box, __spreadValues({
|
|
173
|
+
component: "table",
|
|
174
|
+
className: cx(classes.month, className),
|
|
175
|
+
ref
|
|
176
|
+
}, others), !hideWeekdays && /* @__PURE__ */ React__default.createElement("thead", null, /* @__PURE__ */ React__default.createElement("tr", null, weekdays)), /* @__PURE__ */ React__default.createElement("tbody", null, rows));
|
|
177
|
+
});
|
|
209
178
|
Month.displayName = "@mantine/core/Month";
|
|
210
179
|
|
|
211
180
|
exports.Month = Month;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Month.js","sources":["../../../src/components/Month/Month.tsx"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport {\n DefaultProps,\n Text,\n MantineSize,\n ClassNames,\n useExtractedMargins,\n useMantineTheme,\n} from '@mantine/core';\nimport { upperFirst } from '@mantine/hooks';\nimport dayjs from 'dayjs';\nimport { FirstDayOfWeek } from '../../types';\nimport { getMonthDays, isSameMonth, getWeekdaysNames } from '../../utils';\nimport { Day, DayStylesNames } from './Day/Day';\nimport { getDayProps, DayModifiers } from './get-day-props/get-day-props';\nimport useStyles from './Month.styles';\n\nexport interface MonthSettings {\n /** Adds className to day button based on date and modifiers */\n dayClassName?(date: Date, modifiers: DayModifiers): string;\n\n /** Adds style to day button based on date and modifiers */\n dayStyle?(date: Date, modifiers: DayModifiers): React.CSSProperties;\n\n /** When true dates that are outside of given month are not styled */\n disableOutsideDayStyle?: boolean;\n\n /** When true dates that are outside of given month cannot be clicked or focused */\n disableOutsideEvents?: boolean;\n\n /** Minimum possible date */\n minDate?: Date;\n\n /** Maximum possible date */\n maxDate?: Date;\n\n /** Callback function to determine if day should be disabled */\n excludeDate?(date: Date): boolean;\n\n /** Set to false to remove weekdays row */\n hideWeekdays?: boolean;\n\n /** Controls month days font-size and height */\n size?: MantineSize;\n\n /** Set to true to make calendar take 100% of container width */\n fullWidth?: boolean;\n\n /** Prevent focusing upon clicking */\n preventFocus?: boolean;\n}\n\nexport type MonthStylesNames = ClassNames<typeof useStyles> | DayStylesNames;\n\nexport interface MonthProps\n extends DefaultProps<MonthStylesNames>,\n MonthSettings,\n Omit<React.ComponentPropsWithoutRef<'table'>, 'onChange' | 'value'> {\n /** Date at which month should be shown */\n month: Date;\n\n /** Locale is used to get weekdays names with dayjs format */\n locale?: string;\n\n /** Selected date */\n value?: Date;\n\n /** Selected range */\n range?: [Date, Date];\n\n /** Autofocus selected date on mount, if no date is selected autofocus is applied to first month day */\n autoFocus?: boolean;\n\n /** Called when day is selected */\n onChange?(value: Date): void;\n\n /** Static css selector base */\n __staticSelector?: string;\n\n /** Called when onMouseEnter event fired on day button */\n onDayMouseEnter?(date: Date, event: React.MouseEvent): void;\n\n /** Set first day of the week */\n firstDayOfWeek?: FirstDayOfWeek;\n}\n\nconst noop = () => {};\n\nexport function Month({\n className,\n style,\n month,\n value,\n onChange,\n autoFocus = false,\n disableOutsideEvents = false,\n locale,\n dayClassName,\n dayStyle,\n disableOutsideDayStyle = false,\n classNames,\n styles,\n minDate,\n maxDate,\n excludeDate,\n onDayMouseEnter,\n range,\n hideWeekdays = false,\n __staticSelector = 'Month',\n size = 'sm',\n fullWidth = false,\n preventFocus = false,\n sx,\n firstDayOfWeek = 'monday',\n ...others\n}: MonthProps) {\n const { classes, cx } = useStyles(\n { fullWidth },\n { sx, classNames, styles, name: __staticSelector }\n );\n const { mergedStyles, rest } = useExtractedMargins({ others, style });\n const theme = useMantineTheme();\n const finalLocale = locale || theme.datesLocale;\n const daysRefs = useRef<Record<string, HTMLButtonElement>>({});\n const days = getMonthDays(month, firstDayOfWeek);\n\n const focusDay = (date: Date, diff: number) => {\n const offset = new Date(date);\n offset.setDate(date.getDate() + diff);\n\n if (offset.toISOString() in daysRefs.current) {\n if (!(!isSameMonth(month, offset) && disableOutsideEvents)) {\n daysRefs.current[offset.toISOString()].focus();\n }\n }\n };\n\n const handleKeyDown = (currentDate: Date, event: React.KeyboardEvent) => {\n const { code } = event.nativeEvent;\n\n if (code === 'ArrowUp') {\n event.preventDefault();\n focusDay(currentDate, -7);\n }\n\n if (code === 'ArrowDown') {\n event.preventDefault();\n focusDay(currentDate, 7);\n }\n\n if (code === 'ArrowRight') {\n event.preventDefault();\n currentDate.getDay() !== 0 && focusDay(currentDate, 1);\n }\n\n if (code === 'ArrowLeft') {\n event.preventDefault();\n currentDate.getDay() !== 1 && focusDay(currentDate, -1);\n }\n };\n\n useEffect(() => {\n if (autoFocus) {\n const date = new Date(\n month.getFullYear(),\n month.getMonth(),\n value ? value.getDate() : 1\n ).toISOString();\n\n if (date in daysRefs.current) {\n daysRefs.current[date].focus();\n }\n }\n }, []);\n\n const weekdays = getWeekdaysNames(finalLocale, firstDayOfWeek).map((weekday) => (\n <th className={classes.weekdayCell} key={weekday}>\n <Text size={size} className={classes.weekday}>\n {upperFirst(weekday)}\n </Text>\n </th>\n ));\n\n const hasValue = value instanceof Date;\n const hasValueInMonthRange =\n hasValue &&\n dayjs(value).isAfter(dayjs(month).startOf('month')) &&\n dayjs(value).isBefore(dayjs(month).endOf('month'));\n\n const rows = days.map((row, rowIndex) => {\n const cells = row.map((date, cellIndex) => {\n const dayProps = getDayProps({\n date,\n month,\n hasValue,\n minDate,\n maxDate,\n value,\n excludeDate,\n disableOutsideEvents,\n range,\n });\n\n const withoutStylesOutsideMonth = disableOutsideDayStyle && dayProps.outside;\n\n return (\n <td className={classes.cell} key={cellIndex}>\n <Day\n ref={(button) => {\n daysRefs.current[date.toISOString()] = button;\n }}\n onClick={() => typeof onChange === 'function' && onChange(date)}\n onMouseDown={(event) => preventFocus && event.preventDefault()}\n value={date}\n outside={dayProps.outside}\n weekend={dayProps.weekend}\n inRange={dayProps.inRange && !withoutStylesOutsideMonth}\n firstInRange={dayProps.firstInRange}\n lastInRange={dayProps.lastInRange}\n firstInMonth={cellIndex === 0 && rowIndex === 0}\n selected={(dayProps.selected || dayProps.selectedInRange) && !withoutStylesOutsideMonth}\n hasValue={hasValueInMonthRange}\n onKeyDown={handleKeyDown}\n className={typeof dayClassName === 'function' ? dayClassName(date, dayProps) : null}\n style={typeof dayStyle === 'function' ? dayStyle(date, dayProps) : null}\n styles={styles}\n classNames={classNames}\n disabled={dayProps.disabled}\n __staticSelector={__staticSelector}\n onMouseEnter={typeof onDayMouseEnter === 'function' ? onDayMouseEnter : noop}\n size={size}\n fullWidth={fullWidth}\n />\n </td>\n );\n });\n\n return <tr key={rowIndex}>{cells}</tr>;\n });\n\n return (\n <table className={cx(classes.root, className)} style={mergedStyles} {...rest}>\n {!hideWeekdays && (\n <thead>\n <tr>{weekdays}</tr>\n </thead>\n )}\n <tbody>{rows}</tbody>\n </table>\n );\n}\n\nMonth.displayName = '@mantine/core/Month';\n"],"names":["useStyles","useExtractedMargins","useMantineTheme","useRef","getMonthDays","isSameMonth","useEffect","getWeekdaysNames","React","Text","upperFirst","dayjs","getDayProps","Day"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,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sx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { DefaultProps, Text, Box, MantineSize, ClassNames } from '@mantine/core';\nimport { upperFirst } from '@mantine/hooks';\nimport dayjs from 'dayjs';\nimport { FirstDayOfWeek } from '../../types';\nimport { getMonthDays, getWeekdaysNames, isSameDate } from '../../utils';\nimport { Day, DayStylesNames } from './Day/Day';\nimport { getDayProps } from './get-day-props/get-day-props';\nimport { DayKeydownPayload, DayModifiers } from './types';\nimport useStyles from './Month.styles';\n\nexport interface MonthSettings {\n /** Adds className to day button based on date and modifiers */\n dayClassName?(date: Date, modifiers: DayModifiers): string;\n\n /** Adds style to day button based on date and modifiers */\n dayStyle?(date: Date, modifiers: DayModifiers): React.CSSProperties;\n\n /** When true dates that are outside of given month cannot be clicked or focused */\n disableOutsideEvents?: boolean;\n\n /** Minimum possible date */\n minDate?: Date;\n\n /** Maximum possible date */\n maxDate?: Date;\n\n /** Callback function to determine if day should be disabled */\n excludeDate?(date: Date): boolean;\n\n /** Set to false to remove weekdays row */\n hideWeekdays?: boolean;\n\n /** Controls month days font-size and height */\n size?: MantineSize;\n\n /** Set to true to make calendar take 100% of container width */\n fullWidth?: boolean;\n\n /** Prevent focusing upon clicking */\n preventFocus?: boolean;\n\n /** Should focusable days have tabIndex={0}? */\n focusable?: boolean;\n\n /** Set first day of the week */\n firstDayOfWeek?: FirstDayOfWeek;\n\n /** Remove outside dates */\n hideOutsideDates?: boolean;\n}\n\nexport type MonthStylesNames = ClassNames<typeof useStyles> | DayStylesNames;\n\nexport interface MonthProps\n extends DefaultProps<MonthStylesNames>,\n MonthSettings,\n Omit<React.ComponentPropsWithoutRef<'table'>, 'onChange' | 'value'> {\n /** Date at which month should be shown */\n month: Date;\n\n /** Locale is used to get weekdays names with dayjs format */\n locale?: string;\n\n /** Selected date */\n value?: Date;\n\n /** Selected range */\n range?: [Date, Date];\n\n /** Called when day is selected */\n onChange?(value: Date): void;\n\n /** Static css selector base */\n __staticSelector?: string;\n\n /** Called when onMouseEnter event fired on day button */\n onDayMouseEnter?(date: Date, event: React.MouseEvent): void;\n\n /** Get days buttons refs */\n daysRefs?: HTMLButtonElement[][];\n\n /** Called when keydown event is registered on day */\n onDayKeyDown?(payload: DayKeydownPayload, event: React.KeyboardEvent<HTMLButtonElement>): void;\n}\n\nconst noop = () => {};\n\nexport const Month = forwardRef<HTMLTableElement, MonthProps>(\n (\n {\n className,\n month,\n value,\n onChange,\n disableOutsideEvents = false,\n locale,\n dayClassName,\n dayStyle,\n classNames,\n styles,\n minDate,\n maxDate,\n excludeDate,\n onDayMouseEnter,\n range,\n hideWeekdays = false,\n __staticSelector = 'Month',\n size = 'sm',\n fullWidth = false,\n preventFocus = false,\n focusable = true,\n firstDayOfWeek = 'monday',\n onDayKeyDown,\n daysRefs,\n hideOutsideDates = false,\n ...others\n }: MonthProps,\n ref\n ) => {\n const { classes, cx, theme } = useStyles(\n { fullWidth },\n { classNames, styles, name: __staticSelector }\n );\n const finalLocale = locale || theme.datesLocale;\n const days = getMonthDays(month, firstDayOfWeek);\n\n const weekdays = getWeekdaysNames(finalLocale, firstDayOfWeek).map((weekday) => (\n <th className={classes.weekdayCell} key={weekday}>\n <Text size={size} className={classes.weekday}>\n {upperFirst(weekday)}\n </Text>\n </th>\n ));\n\n const hasValue = value instanceof Date;\n const hasValueInMonthRange =\n hasValue &&\n dayjs(value).isAfter(dayjs(month).startOf('month')) &&\n dayjs(value).isBefore(dayjs(month).endOf('month'));\n\n const rows = days.map((row, rowIndex) => {\n const cells = row.map((date, cellIndex) => {\n const dayProps = getDayProps({\n date,\n month,\n hasValue,\n minDate,\n maxDate,\n value,\n excludeDate,\n disableOutsideEvents,\n range,\n });\n\n const onKeyDownPayload = { rowIndex, cellIndex, date };\n\n return (\n <td className={classes.cell} key={cellIndex}>\n <Day\n ref={(button) => {\n if (daysRefs) {\n if (!Array.isArray(daysRefs[rowIndex])) {\n // eslint-disable-next-line no-param-reassign\n daysRefs[rowIndex] = [];\n }\n\n // eslint-disable-next-line no-param-reassign\n daysRefs[rowIndex][cellIndex] = button;\n }\n }}\n onClick={() => typeof onChange === 'function' && onChange(date)}\n onMouseDown={(event) => preventFocus && event.preventDefault()}\n value={date}\n outside={dayProps.outside}\n weekend={dayProps.weekend}\n inRange={dayProps.inRange}\n firstInRange={dayProps.firstInRange}\n lastInRange={dayProps.lastInRange}\n firstInMonth={\n hideOutsideDates\n ? isSameDate(date, dayjs(month).startOf('month').toDate())\n : cellIndex === 0 && rowIndex === 0\n }\n selected={dayProps.selected || dayProps.selectedInRange}\n hasValue={hasValueInMonthRange}\n onKeyDown={(event) =>\n typeof onDayKeyDown === 'function' && onDayKeyDown(onKeyDownPayload, event)\n }\n className={typeof dayClassName === 'function' ? dayClassName(date, dayProps) : null}\n style={typeof dayStyle === 'function' ? dayStyle(date, dayProps) : null}\n disabled={dayProps.disabled}\n onMouseEnter={typeof onDayMouseEnter === 'function' ? onDayMouseEnter : noop}\n size={size}\n fullWidth={fullWidth}\n focusable={focusable}\n hideOutsideDates={hideOutsideDates}\n __staticSelector={__staticSelector}\n styles={styles}\n classNames={classNames}\n />\n </td>\n );\n });\n\n return <tr key={rowIndex}>{cells}</tr>;\n });\n\n return (\n <Box component=\"table\" className={cx(classes.month, className)} ref={ref} {...others}>\n {!hideWeekdays && (\n <thead>\n <tr>{weekdays}</tr>\n </thead>\n )}\n <tbody>{rows}</tbody>\n </Box>\n );\n }\n);\n\nMonth.displayName = '@mantine/core/Month';\n"],"names":["forwardRef","useStyles","getMonthDays","getWeekdaysNames","React","Text","upperFirst","dayjs","getDayProps","Day","isSameDate","Box"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAo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AACxB,QAAQ,MAAM;AACd,QAAQ,UAAU;AAClB,OAAO,CAAC,CAAC,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,uBAAuBH,cAAK,CAAC,aAAa,CAAC,IAAI,EAAE;AACrD,MAAM,GAAG,EAAE,QAAQ;AACnB,KAAK,EAAE,KAAK,CAAC,CAAC;AACd,GAAG,CAAC,CAAC;AACL,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAACO,QAAG,EAAE,cAAc,CAAC;AACjE,IAAI,SAAS,EAAE,OAAO;AACtB,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;AAC3C,IAAI,GAAG;AACP,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,YAAY,oBAAoBP,cAAK,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,kBAAkBA,cAAK,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,kBAAkBA,cAAK,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACxM,CAAC,EAAE;AACH,KAAK,CAAC,WAAW,GAAG,qBAAqB;;;;"}
|
|
@@ -27,7 +27,7 @@ var useStyles = core.createStyles((theme, { fullWidth }) => ({
|
|
|
27
27
|
weekday: {
|
|
28
28
|
color: theme.colorScheme === "dark" ? theme.colors.dark[1] : theme.colors.gray[5]
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
month: __spreadProps(__spreadValues({}, theme.fn.fontStyles()), {
|
|
31
31
|
borderCollapse: "collapse",
|
|
32
32
|
width: fullWidth ? "100%" : "auto",
|
|
33
33
|
tableLayout: "fixed"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Month.styles.js","sources":["../../../src/components/Month/Month.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/core';\n\ninterface MonthStyles {\n fullWidth: boolean;\n}\n\nexport default createStyles((theme, { fullWidth }: MonthStyles) => ({\n weekday: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[1] : theme.colors.gray[5],\n },\n\n
|
|
1
|
+
{"version":3,"file":"Month.styles.js","sources":["../../../src/components/Month/Month.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/core';\n\ninterface MonthStyles {\n fullWidth: boolean;\n}\n\nexport default createStyles((theme, { fullWidth }: MonthStyles) => ({\n weekday: {\n color: theme.colorScheme === 'dark' ? theme.colors.dark[1] : theme.colors.gray[5],\n },\n\n month: {\n ...theme.fn.fontStyles(),\n borderCollapse: 'collapse',\n width: fullWidth ? '100%' : 'auto',\n tableLayout: 'fixed',\n },\n\n cell: {\n boxSizing: 'border-box',\n padding: 0,\n borderTop: '1px solid transparent',\n },\n\n weekdayCell: {\n boxSizing: 'border-box',\n padding: 0,\n fontWeight: 'normal',\n paddingBottom: theme.spacing.xs / 2,\n textAlign: 'center',\n cursor: 'default',\n userSelect: 'none',\n },\n}));\n"],"names":["createStyles"],"mappings":";;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IA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I,SAAS,EAAE,YAAY;AAC3B,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,SAAS,EAAE,uBAAuB;AACtC,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,UAAU,EAAE,QAAQ;AACxB,IAAI,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC;AACvC,IAAI,SAAS,EAAE,QAAQ;AACvB,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,UAAU,EAAE,MAAM;AACtB,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
require('dayjs');
|
|
6
6
|
var isSameDate = require('../../../utils/is-same-date/is-same-date.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
7
|
+
var isWeekend = require('./is-weekend/is-weekend.js');
|
|
8
|
+
var isOutside = require('./is-outside/is-outside.js');
|
|
9
|
+
var isDisabled = require('./is-disabled/is-disabled.js');
|
|
10
|
+
var getRangeProps = require('./get-range-props/get-range-props.js');
|
|
11
11
|
|
|
12
12
|
function getDayProps({
|
|
13
13
|
date,
|
|
@@ -20,32 +20,17 @@ function getDayProps({
|
|
|
20
20
|
disableOutsideEvents,
|
|
21
21
|
range
|
|
22
22
|
}) {
|
|
23
|
-
const
|
|
24
|
-
const weekend = weekday === 6 || weekday === 0;
|
|
25
|
-
const outside = date.getMonth() !== month.getMonth();
|
|
23
|
+
const outside = isOutside.isOutside(date, month);
|
|
26
24
|
const selected = hasValue && isSameDate.isSameDate(date, value);
|
|
27
|
-
const
|
|
28
|
-
const isBeforeMin = minDate instanceof Date && dayjs__default(minDate).isAfter(date, "day");
|
|
29
|
-
const shouldExclude = typeof excludeDate === "function" && excludeDate(date);
|
|
30
|
-
const disabledOutside = disableOutsideEvents && outside;
|
|
31
|
-
const disabled = isAfterMax || isBeforeMin || shouldExclude || disabledOutside;
|
|
32
|
-
const hasRange = Array.isArray(range) && range.every((val) => val instanceof Date);
|
|
33
|
-
const inclusiveRange = hasRange && [
|
|
34
|
-
dayjs__default(range[0]).subtract(1, "day"),
|
|
35
|
-
dayjs__default(range[1]).add(1, "day")
|
|
36
|
-
];
|
|
37
|
-
const firstInRange = hasRange && isSameDate.isSameDate(date, range[0]);
|
|
38
|
-
const lastInRange = hasRange && isSameDate.isSameDate(date, range[1]);
|
|
39
|
-
const inRange = hasRange && dayjs__default(date).isAfter(inclusiveRange[0], "day") && dayjs__default(date).isBefore(inclusiveRange[1], "day");
|
|
40
|
-
const selectedInRange = firstInRange || lastInRange;
|
|
25
|
+
const { inRange, lastInRange, firstInRange, selectedInRange } = getRangeProps.getRangeProps(date, range);
|
|
41
26
|
return {
|
|
27
|
+
disabled: isDisabled.isDisabled({ minDate, maxDate, excludeDate, disableOutsideEvents, date, outside }),
|
|
28
|
+
weekend: isWeekend.isWeekend(date),
|
|
42
29
|
selectedInRange,
|
|
43
30
|
selected,
|
|
44
|
-
disabled,
|
|
45
31
|
inRange,
|
|
46
32
|
firstInRange,
|
|
47
33
|
lastInRange,
|
|
48
|
-
weekend,
|
|
49
34
|
outside
|
|
50
35
|
};
|
|
51
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-day-props.js","sources":["../../../../src/components/Month/get-day-props/get-day-props.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"get-day-props.js","sources":["../../../../src/components/Month/get-day-props/get-day-props.ts"],"sourcesContent":["import { isSameDate } from '../../../utils';\nimport { DayModifiers } from '../types';\nimport { isWeekend } from './is-weekend/is-weekend';\nimport { isOutside } from './is-outside/is-outside';\nimport { isDisabled } from './is-disabled/is-disabled';\nimport { getRangeProps } from './get-range-props/get-range-props';\n\ninterface GetDayProps {\n /** Date associated with Day component */\n date: Date;\n\n /** Month that is currently displayed */\n month: Date;\n\n /** Does month have value prop? */\n hasValue: boolean;\n\n /** Min and max possible dates */\n maxDate: Date;\n minDate: Date;\n\n /** Currently selected date */\n value: Date;\n\n /** Function to determine if date should be excluded */\n excludeDate(date: Date): boolean;\n\n /** Should outside events be disabled */\n disableOutsideEvents: boolean;\n\n /** Selected date range */\n range: [Date, Date];\n}\n\nexport function getDayProps({\n date,\n month,\n hasValue,\n minDate,\n maxDate,\n value,\n excludeDate,\n disableOutsideEvents,\n range,\n}: GetDayProps): DayModifiers {\n const outside = isOutside(date, month);\n const selected = hasValue && isSameDate(date, value);\n const { inRange, lastInRange, firstInRange, selectedInRange } = getRangeProps(date, range);\n\n return {\n disabled: isDisabled({ minDate, maxDate, excludeDate, disableOutsideEvents, date, outside }),\n weekend: isWeekend(date),\n selectedInRange,\n selected,\n inRange,\n firstInRange,\n lastInRange,\n outside,\n };\n}\n"],"names":["isOutside","isSameDate","getRangeProps","isDisabled","isWeekend"],"mappings":";;;;;;;;;;;AAKO,SAAS,WAAW,CAAC;AAC5B,EAAE,IAAI;AACN,EAAE,KAAK;AACP,EAAE,QAAQ;AACV,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,KAAK;AACP,EAAE,WAAW;AACb,EAAE,oBAAoB;AACtB,EAAE,KAAK;AACP,CAAC,EAAE;AACH,EAAE,MAAM,OAAO,GAAGA,mBAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACzC,EAAE,MAAM,QAAQ,GAAG,QAAQ,IAAIC,qBAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACvD,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,GAAGC,2BAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC7F,EAAE,OAAO;AACT,IAAI,QAAQ,EAAEC,qBAAU,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAChG,IAAI,OAAO,EAAEC,mBAAS,CAAC,IAAI,CAAC;AAC5B,IAAI,eAAe;AACnB,IAAI,QAAQ;AACZ,IAAI,OAAO;AACX,IAAI,YAAY;AAChB,IAAI,WAAW;AACf,IAAI,OAAO;AACX,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dayjs = require('dayjs');
|
|
6
|
+
var isSameDate = require('../../../../utils/is-same-date/is-same-date.js');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
9
|
+
|
|
10
|
+
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
11
|
+
|
|
12
|
+
function getRangeProps(date, range) {
|
|
13
|
+
const hasRange = Array.isArray(range) && range.every((val) => val instanceof Date);
|
|
14
|
+
const inclusiveRange = hasRange && [
|
|
15
|
+
dayjs__default(range[0]).subtract(1, "day"),
|
|
16
|
+
dayjs__default(range[1]).add(1, "day")
|
|
17
|
+
];
|
|
18
|
+
const firstInRange = hasRange && isSameDate.isSameDate(date, range[0]);
|
|
19
|
+
const lastInRange = hasRange && isSameDate.isSameDate(date, range[1]);
|
|
20
|
+
const inRange = hasRange && dayjs__default(date).isAfter(inclusiveRange[0], "day") && dayjs__default(date).isBefore(inclusiveRange[1], "day");
|
|
21
|
+
return { firstInRange, lastInRange, inRange, selectedInRange: firstInRange || lastInRange };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.getRangeProps = getRangeProps;
|
|
25
|
+
//# sourceMappingURL=get-range-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-range-props.js","sources":["../../../../../src/components/Month/get-day-props/get-range-props/get-range-props.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { isSameDate } from '../../../../utils';\n\nexport function getRangeProps(date: Date, range: [Date, Date]) {\n const hasRange = Array.isArray(range) && range.every((val) => val instanceof Date);\n const inclusiveRange = hasRange && [\n dayjs(range[0]).subtract(1, 'day'),\n dayjs(range[1]).add(1, 'day'),\n ];\n\n const firstInRange = hasRange && isSameDate(date, range[0]);\n const lastInRange = hasRange && isSameDate(date, range[1]);\n const inRange =\n hasRange &&\n dayjs(date).isAfter(inclusiveRange[0], 'day') &&\n dayjs(date).isBefore(inclusiveRange[1], 'day');\n\n return { firstInRange, lastInRange, inRange, selectedInRange: firstInRange || lastInRange };\n}\n"],"names":["dayjs","isSameDate"],"mappings":";;;;;;;;;;;AAEO,SAAS,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE;AAC3C,EAAE,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,YAAY,IAAI,CAAC,CAAC;AACrF,EAAE,MAAM,cAAc,GAAG,QAAQ,IAAI;AACrC,IAAIA,cAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC;AACtC,IAAIA,cAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC;AACjC,GAAG,CAAC;AACJ,EAAE,MAAM,YAAY,GAAG,QAAQ,IAAIC,qBAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,EAAE,MAAM,WAAW,GAAG,QAAQ,IAAIA,qBAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,EAAE,MAAM,OAAO,GAAG,QAAQ,IAAID,cAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,IAAIA,cAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC9H,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,IAAI,WAAW,EAAE,CAAC;AAC9F;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dayjs = require('dayjs');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
8
|
+
|
|
9
|
+
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
10
|
+
|
|
11
|
+
function isDisabled({
|
|
12
|
+
minDate,
|
|
13
|
+
maxDate,
|
|
14
|
+
excludeDate,
|
|
15
|
+
disableOutsideEvents,
|
|
16
|
+
date,
|
|
17
|
+
outside
|
|
18
|
+
}) {
|
|
19
|
+
const isAfterMax = maxDate instanceof Date && dayjs__default(maxDate).isBefore(date, "day");
|
|
20
|
+
const isBeforeMin = minDate instanceof Date && dayjs__default(minDate).isAfter(date, "day");
|
|
21
|
+
const shouldExclude = typeof excludeDate === "function" && excludeDate(date);
|
|
22
|
+
const disabledOutside = !!disableOutsideEvents && !!outside;
|
|
23
|
+
return isAfterMax || isBeforeMin || shouldExclude || disabledOutside;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.isDisabled = isDisabled;
|
|
27
|
+
//# sourceMappingURL=is-disabled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-disabled.js","sources":["../../../../../src/components/Month/get-day-props/is-disabled/is-disabled.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\ninterface IsDisabled {\n date: Date;\n minDate?: Date;\n maxDate?: Date;\n excludeDate?(date: Date): boolean;\n disableOutsideEvents?: boolean;\n outside?: boolean;\n}\n\nexport function isDisabled({\n minDate,\n maxDate,\n excludeDate,\n disableOutsideEvents,\n date,\n outside,\n}: IsDisabled) {\n const isAfterMax = maxDate instanceof Date && dayjs(maxDate).isBefore(date, 'day');\n const isBeforeMin = minDate instanceof Date && dayjs(minDate).isAfter(date, 'day');\n const shouldExclude = typeof excludeDate === 'function' && excludeDate(date);\n const disabledOutside = !!disableOutsideEvents && !!outside;\n return isAfterMax || isBeforeMin || shouldExclude || disabledOutside;\n}\n"],"names":["dayjs"],"mappings":";;;;;;;;;;AACO,SAAS,UAAU,CAAC;AAC3B,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,WAAW;AACb,EAAE,oBAAoB;AACtB,EAAE,IAAI;AACN,EAAE,OAAO;AACT,CAAC,EAAE;AACH,EAAE,MAAM,UAAU,GAAG,OAAO,YAAY,IAAI,IAAIA,cAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACrF,EAAE,MAAM,WAAW,GAAG,OAAO,YAAY,IAAI,IAAIA,cAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACrF,EAAE,MAAM,aAAa,GAAG,OAAO,WAAW,KAAK,UAAU,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;AAC/E,EAAE,MAAM,eAAe,GAAG,CAAC,CAAC,oBAAoB,IAAI,CAAC,CAAC,OAAO,CAAC;AAC9D,EAAE,OAAO,UAAU,IAAI,WAAW,IAAI,aAAa,IAAI,eAAe,CAAC;AACvE;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('dayjs');
|
|
6
|
+
var isSameMonth = require('../../../../utils/is-same-month/is-same-month.js');
|
|
7
|
+
|
|
8
|
+
function isOutside(date, month) {
|
|
9
|
+
return !isSameMonth.isSameMonth(date, month);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.isOutside = isOutside;
|
|
13
|
+
//# sourceMappingURL=is-outside.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-outside.js","sources":["../../../../../src/components/Month/get-day-props/is-outside/is-outside.ts"],"sourcesContent":["import { isSameMonth } from '../../../../utils';\n\nexport function isOutside(date: Date, month: Date) {\n return !isSameMonth(date, month);\n}\n"],"names":["isSameMonth"],"mappings":";;;;;;;AACO,SAAS,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE;AACvC,EAAE,OAAO,CAACA,uBAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACnC;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function isWeekend(date) {
|
|
6
|
+
const weekday = date.getDay();
|
|
7
|
+
return weekday === 6 || weekday === 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.isWeekend = isWeekend;
|
|
11
|
+
//# sourceMappingURL=is-weekend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-weekend.js","sources":["../../../../../src/components/Month/get-day-props/is-weekend/is-weekend.ts"],"sourcesContent":["export function isWeekend(date: Date) {\n const weekday = date.getDay();\n return weekday === 6 || weekday === 0;\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,SAAS,CAAC,IAAI,EAAE;AAChC,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;AAChC,EAAE,OAAO,OAAO,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC;AACxC;;;;"}
|