@mantine/dates
Version:
Calendars, date and time pickers based on Mantine components
86 lines (85 loc) • 3.39 kB
JavaScript
"use client";
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
const require_use_dates_context = require("../DatesProvider/use-dates-context.cjs");
const require_Month = require("../Month/Month.cjs");
const require_CalendarHeader = require("../CalendarHeader/CalendarHeader.cjs");
let dayjs = require("dayjs");
dayjs = require_runtime.__toESM(dayjs);
let react_jsx_runtime = require("react/jsx-runtime");
let _mantine_core = require("@mantine/core");
//#region packages/@mantine/dates/src/components/MonthLevel/MonthLevel.tsx
const defaultProps = { monthLabelFormat: "MMMM YYYY" };
const MonthLevel = (0, _mantine_core.factory)((_props) => {
const { month, locale, firstDayOfWeek, weekdayFormat, weekendDays, getDayProps, excludeDate, minDate, maxDate, renderDay, hideOutsideDates, hideWeekdays, getDayAriaLabel, __getDayRef, __onDayKeyDown, __onDayClick, __onDayMouseEnter, withCellSpacing, highlightToday, withWeekNumbers, __preventFocus, __stopPropagation, nextIcon, previousIcon, nextLabel, previousLabel, onNext, onPrevious, onLevelClick, nextDisabled, previousDisabled, hasNextLevel, levelControlAriaLabel, withNext, withPrevious, headerControlsOrder, monthLabelFormat, classNames, styles, unstyled, __staticSelector, size, static: isStatic, fullWidth, attributes, ...others } = (0, _mantine_core.useProps)("MonthLevel", defaultProps, _props);
const ctx = require_use_dates_context.useDatesContext();
const stylesApiProps = {
__staticSelector: __staticSelector || "MonthLevel",
classNames,
styles,
unstyled,
size,
attributes
};
const _nextDisabled = typeof nextDisabled === "boolean" ? nextDisabled : maxDate ? !(0, dayjs.default)(month).endOf("month").isBefore(maxDate) : false;
const _previousDisabled = typeof previousDisabled === "boolean" ? previousDisabled : minDate ? !(0, dayjs.default)(month).startOf("month").isAfter(minDate) : false;
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Box, {
"data-month-level": true,
size,
...others,
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CalendarHeader.CalendarHeader, {
label: typeof monthLabelFormat === "function" ? monthLabelFormat(month) : (0, dayjs.default)(month).locale(locale || ctx.locale).format(monthLabelFormat),
__preventFocus,
__stopPropagation,
nextIcon,
previousIcon,
nextLabel,
previousLabel,
onNext,
onPrevious,
onLevelClick,
nextDisabled: _nextDisabled,
previousDisabled: _previousDisabled,
hasNextLevel,
levelControlAriaLabel,
withNext,
withPrevious,
headerControlsOrder,
fullWidth,
...stylesApiProps
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Month.Month, {
month,
locale,
firstDayOfWeek,
weekdayFormat,
weekendDays,
getDayProps,
excludeDate,
minDate,
maxDate,
renderDay,
hideOutsideDates,
hideWeekdays,
getDayAriaLabel,
__getDayRef,
__onDayKeyDown,
__onDayClick,
__onDayMouseEnter,
__preventFocus,
__stopPropagation,
static: isStatic,
withCellSpacing,
highlightToday,
withWeekNumbers,
fullWidth,
...stylesApiProps
})]
});
});
MonthLevel.classes = {
...require_Month.Month.classes,
...require_CalendarHeader.CalendarHeader.classes
};
MonthLevel.displayName = "@mantine/dates/MonthLevel";
//#endregion
exports.MonthLevel = MonthLevel;
//# sourceMappingURL=MonthLevel.cjs.map