UNPKG

@mantine/dates

Version:

Calendars, date and time pickers based on Mantine components

84 lines (83 loc) 2.98 kB
"use client"; import { useDatesContext } from "../DatesProvider/use-dates-context.mjs"; import { Month } from "../Month/Month.mjs"; import { CalendarHeader } from "../CalendarHeader/CalendarHeader.mjs"; import dayjs from "dayjs"; import { jsx, jsxs } from "react/jsx-runtime"; import { Box, factory, useProps } from "@mantine/core"; //#region packages/@mantine/dates/src/components/MonthLevel/MonthLevel.tsx const defaultProps = { monthLabelFormat: "MMMM YYYY" }; const MonthLevel = 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 } = useProps("MonthLevel", defaultProps, _props); const ctx = useDatesContext(); const stylesApiProps = { __staticSelector: __staticSelector || "MonthLevel", classNames, styles, unstyled, size, attributes }; const _nextDisabled = typeof nextDisabled === "boolean" ? nextDisabled : maxDate ? !dayjs(month).endOf("month").isBefore(maxDate) : false; const _previousDisabled = typeof previousDisabled === "boolean" ? previousDisabled : minDate ? !dayjs(month).startOf("month").isAfter(minDate) : false; return /* @__PURE__ */ jsxs(Box, { "data-month-level": true, size, ...others, children: [/* @__PURE__ */ jsx(CalendarHeader, { label: typeof monthLabelFormat === "function" ? monthLabelFormat(month) : dayjs(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__ */ jsx(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 = { ...Month.classes, ...CalendarHeader.classes }; MonthLevel.displayName = "@mantine/dates/MonthLevel"; //#endregion export { MonthLevel }; //# sourceMappingURL=MonthLevel.mjs.map